TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator Class Reference

#include <PointHashGrid.h>

Classes

class  CellObject
 

Public Member Functions

const CellObjectoperator* () const
 
const CellObjectoperator-> () const
 
 operator CellObject * () const
 
bool operator!= (const CellIterator &other) const
 
bool operator== (const CellIterator &other) const
 
CellIteratoroperator++ ()
 
CellIterator operator++ (int)
 
bool hasMore () const
 
bool isValid () const
 

Private Member Functions

Cellcell ()
 
 CellIterator ()
 
 CellIterator (const ThisType *grid)
 
CellIteratoroperator= (const CellIterator &)
 

Private Attributes

bool m_isEnd
 
const ThisTypem_grid
 
CellTable::Iterator m_tableIterator
 
const int m_epoch
 
CellObject m_indirection
 

Friends

class ThisType
 

Detailed Description

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
class G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator

Dereference to access the bounds() and size() [element count] of the underlying cell object.

Example:

for(PointHashGrid<Vector3>::CellIterator iter = grid.beginCells(); iter != grid.endCells(); ++iter) {    
entriesFound += iter->size();
}

Constructor & Destructor Documentation

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::CellIterator ( )
inlineprivate

End iterator. Note that the m_tableIterator is initialized to the end iterator of a temporary value! This is ok because we'll never look at the value of the m_tableIterator, since we're initializing the "end" Iterator.

907  :
908  m_isEnd(true),
909  m_grid(NULL),
911  m_epoch(0) {}
const Iterator & end() const
Definition: PointHashGrid.h:516
const int m_epoch
Definition: PointHashGrid.h:868
arena_t NULL
Definition: jemalloc_internal.h:624
bool m_isEnd
Definition: PointHashGrid.h:865
Table< Point3int32, Cell > CellTable
Definition: PointHashGrid.h:110
const ThisType * m_grid
Definition: PointHashGrid.h:866
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:867
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::CellIterator ( const ThisType grid)
inlineprivate
913  :
914  m_isEnd(false),
915  m_grid(grid),
916  m_tableIterator( grid->m_data.begin()),
917  m_epoch(grid->m_epoch) {
918  m_indirection.m_parent = this;
919  m_isEnd = ! m_tableIterator.isValid();
920  }
CellObject m_indirection
Definition: PointHashGrid.h:902
const int m_epoch
Definition: PointHashGrid.h:868
bool m_isEnd
Definition: PointHashGrid.h:865
const ThisType * m_grid
Definition: PointHashGrid.h:866
const CellIterator * m_parent
Definition: PointHashGrid.h:880
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:867

+ Here is the call graph for this function:

Member Function Documentation

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
Cell& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::cell ( )
inlineprivate
871  {
872  return m_tableIterator->value;
873  }
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:867
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::hasMore ( ) const
inline
Deprecated:
Use isValid
961  {
962  return ! m_isEnd;
963  }
bool m_isEnd
Definition: PointHashGrid.h:865
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::isValid ( ) const
inline
965  {
966  return ! m_isEnd;
967  }
bool m_isEnd
Definition: PointHashGrid.h:865

+ Here is the caller graph for this function:

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator CellObject * ( ) const
inline
929 { return &m_indirection; }
CellObject m_indirection
Definition: PointHashGrid.h:902
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator!= ( const CellIterator other) const
inline
931  {
932  // != is called more often than == during iteration
933  return !(
934  (m_isEnd && other.m_isEnd) ||
935  ((m_isEnd == other.m_isEnd) &&
936  (m_tableIterator != other.m_tableIterator)));
937  }
bool m_isEnd
Definition: PointHashGrid.h:865
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:867
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const CellObject& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator* ( ) const
inline
927 { return m_indirection; }
CellObject m_indirection
Definition: PointHashGrid.h:902
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
CellIterator& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator++ ( )
inline

Preincrement

944  {
945  debugAssertM(m_epoch == m_grid->m_epoch,
946  "It is illegal to mutate the HashGrid while "
947  "iterating through it.");
948  ++m_tableIterator;
949  m_isEnd = ! m_tableIterator.isValid();
950  return *this;
951  }
const int m_epoch
Definition: PointHashGrid.h:868
bool m_isEnd
Definition: PointHashGrid.h:865
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
const ThisType * m_grid
Definition: PointHashGrid.h:866
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:867
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
CellIterator G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator++ ( int  )
inline

Post increment (slower)

954  {
955  Iterator old = *this;
956  ++(*this);
957  return old;
958  }
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const CellObject* G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator-> ( ) const
inline
928 { return &m_indirection; }
CellObject m_indirection
Definition: PointHashGrid.h:902
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
CellIterator& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator= ( const CellIterator )
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::operator== ( const CellIterator other) const
inline
939  {
940  return !(*this != other);
941  }

Friends And Related Function Documentation

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
friend class ThisType
friend

Member Data Documentation

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const int G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::m_epoch
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const ThisType* G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::m_grid
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
CellObject G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::m_indirection
private

Used to make the indirection work.

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::m_isEnd
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
CellTable::Iterator G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::CellIterator::m_tableIterator
private

The documentation for this class was generated from the following file: