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

#include <PointHashGrid.h>

Public Member Functions

bool operator!= (const Iterator &other) const
 
bool isValid () const
 
bool hasMore () const
 
bool operator== (const Iterator &other) const
 
Iteratoroperator++ ()
 
Iterator operator++ (int)
 
const Valueoperator* () const
 
const Valueoperator-> () const
 
 operator Value * () const
 

Private Member Functions

 Iterator ()
 
 Iterator (const ThisType *grid)
 
const Valuevalue () const
 

Private Attributes

bool m_isEnd
 
const ThisTypem_grid
 
CellTable::Iterator m_tableIterator
 
int m_arrayIndex
 
const int m_epoch
 

Friends

class ThisType
 

Constructor & Destructor Documentation

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::Iterator ( )
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.

422  : m_isEnd(true), m_grid(NULL), m_tableIterator(CellTable().end()),
423  m_arrayIndex(0), m_epoch(0) {}
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:412
const Iterator & end() const
Definition: PointHashGrid.h:516
arena_t NULL
Definition: jemalloc_internal.h:624
const int m_epoch
Definition: PointHashGrid.h:417
int m_arrayIndex
Definition: PointHashGrid.h:415
Table< Point3int32, Cell > CellTable
Definition: PointHashGrid.h:110
bool m_isEnd
Definition: PointHashGrid.h:408
const ThisType * m_grid
Definition: PointHashGrid.h:410
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::Iterator ( const ThisType grid)
inlineprivate
425  :
426  m_isEnd(grid->size() == 0),
427  m_grid(grid),
428  m_tableIterator( grid->m_data.begin() ),
429  m_arrayIndex(0),
430  m_epoch(grid->m_epoch) { }
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:412
const int m_epoch
Definition: PointHashGrid.h:417
int m_arrayIndex
Definition: PointHashGrid.h:415
bool m_isEnd
Definition: PointHashGrid.h:408
const ThisType * m_grid
Definition: PointHashGrid.h:410

Member Function Documentation

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::hasMore ( ) const
inline
Deprecated:
Use isValid
458  {
459  return ! m_isEnd;
460  }
bool m_isEnd
Definition: PointHashGrid.h:408
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::isValid ( ) const
inline
453  {
454  return ! m_isEnd;
455  }
bool m_isEnd
Definition: PointHashGrid.h:408

+ Here is the caller graph for this function:

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator Value * ( ) const
inline
497 { return &value(); }
const Value & value() const
Definition: PointHashGrid.h:434

+ Here is the call graph for this function:

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator!= ( const Iterator other) const
inline
443  {
444  if (other.m_isEnd && m_isEnd) {
445  return false;
446  } else {
447  return (m_isEnd != other.m_isEnd) ||
448  (m_tableIterator != other.m_tableIterator) ||
449  (m_arrayIndex != other.m_arrayIndex);
450  }
451  }
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:412
int m_arrayIndex
Definition: PointHashGrid.h:415
bool m_isEnd
Definition: PointHashGrid.h:408
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const Value& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator* ( ) const
inline
495 { return value(); }
const Value & value() const
Definition: PointHashGrid.h:434

+ Here is the call graph for this function:

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
Iterator& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator++ ( )
inline

Preincrement

467  {
468  debugAssert(! m_isEnd);
469  debugAssertM(m_epoch == m_grid->m_epoch,
470  "It is illegal to mutate the HashGrid "
471  "while iterating through it.");
472 
473  ++m_arrayIndex;
474 
475  if (m_arrayIndex >= m_tableIterator->value.size()) {
476  // Move on to the next cell
477  ++m_tableIterator;
478  m_arrayIndex = 0;
479 
480  // Check to see if we're at the end
481  m_isEnd = (m_tableIterator == m_grid->m_data.end());
482  }
483 
484  return *this;
485  }
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:412
const int m_epoch
Definition: PointHashGrid.h:417
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
int m_arrayIndex
Definition: PointHashGrid.h:415
#define debugAssert(exp)
Definition: debugAssert.h:160
bool m_isEnd
Definition: PointHashGrid.h:408
const ThisType * m_grid
Definition: PointHashGrid.h:410
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
Iterator G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator++ ( int  )
inline

Post increment (slower)

488  {
489  debugAssert(! m_isEnd);
490  Iterator old = *this;
491  ++(*this);
492  return old;
493  }
Iterator()
Definition: PointHashGrid.h:422
#define debugAssert(exp)
Definition: debugAssert.h:160
bool m_isEnd
Definition: PointHashGrid.h:408
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const Value* G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator-> ( ) const
inline
496 { return &value(); }
const Value & value() const
Definition: PointHashGrid.h:434

+ Here is the call graph for this function:

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::operator== ( const Iterator other) const
inline
462  {
463  return !(*this != other);
464  }
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const Value& G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::value ( ) const
inlineprivate
434  {
435  debugAssert(! m_isEnd);
436  debugAssertM(m_tableIterator->value.size() > m_arrayIndex,
437  "No more elements");
438  return m_tableIterator->value[m_arrayIndex].value;
439  }
CellTable::Iterator m_tableIterator
Definition: PointHashGrid.h:412
#define debugAssertM(exp, message)
Definition: debugAssert.h:161
int m_arrayIndex
Definition: PointHashGrid.h:415
#define debugAssert(exp)
Definition: debugAssert.h:160
bool m_isEnd
Definition: PointHashGrid.h:408

+ Here is the caller graph for this function:

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>>
int G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::m_arrayIndex
private

Index within m_tableIterator->value of the current value.

template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const int G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::m_epoch
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
const ThisType* G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::m_grid
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
bool G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::m_isEnd
private
template<class Value, class PosFunc = PositionTrait<Value>, class EqualsFunc = EqualsTrait<Value>>
CellTable::Iterator G3D::PointHashGrid< Value, PosFunc, EqualsFunc >::Iterator::m_tableIterator
private

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