moab
|
a const iterator which iterates over an Range More...
#include <Range.hpp>
Public Member Functions | |
const_iterator () | |
default constructor - intialize base default constructor | |
const_iterator (const PairNode *iter, const EntityHandle val) | |
constructor used by Range | |
const EntityHandle & | operator* () const |
const_iterator & | operator++ () |
prefix incrementer | |
const_iterator | operator++ (int) |
postfix incrementer | |
const_iterator & | operator-- () |
prefix decrementer | |
const_iterator | operator-- (int) |
postfix decrementer | |
const_iterator & | operator+= (EntityID step) |
const_iterator & | operator-= (EntityID step) |
bool | operator== (const const_iterator &other) const |
equals operator | |
bool | operator!= (const const_iterator &other) const |
not equals operator | |
const_iterator | end_of_block () const |
get an iterator at the end of the block | |
const_iterator | start_of_block () const |
get an iterator at the start of the block | |
Protected Attributes | |
PairNode * | mNode |
the node we are pointing at | |
EntityHandle | mValue |
the value in the range | |
Friends | |
class | Range |
class | pair_iterator |
class | const_pair_iterator |
EntityID | operator- (const const_iterator &, const const_iterator &) |
a const iterator which iterates over an Range
moab::Range::const_iterator::const_iterator | ( | ) | [inline] |
moab::Range::const_iterator::const_iterator | ( | const PairNode * | iter, |
const EntityHandle | val | ||
) | [inline] |
Range::const_iterator moab::Range::const_iterator::end_of_block | ( | ) | const [inline] |
get an iterator at the end of the block
Get an iterator at the end of the block of consecutive handles that this iterator is currently contained in. That is, if the range contains blocks of consecutive handles of the form { [1,5], [7,100], ... } and this iterator is at any handle in the range [7,100], return an iterator at the '100' handle.
Never returns begin() or end() unless this iterator is at begin() or end(). May return the same location as this iterator.
Definition at line 816 of file Range.hpp.
{ return Range::const_iterator( mNode, mNode->second ); }
bool moab::Range::const_iterator::operator!= | ( | const const_iterator & | other | ) | const [inline] |
const EntityHandle& moab::Range::const_iterator::operator* | ( | ) | const [inline] |
const_iterator& moab::Range::const_iterator::operator++ | ( | ) | [inline] |
const_iterator moab::Range::const_iterator::operator++ | ( | int | ) | [inline] |
postfix incrementer
Definition at line 476 of file Range.hpp.
{ // make a temporary copy const_iterator tmp(*this); // increment self this->operator ++(); // return the copy return tmp; }
Range::const_iterator & moab::Range::const_iterator::operator+= | ( | EntityID | sstep | ) |
Advance iterator specified amount. Potentially O(n), but typically better. Always more efficient than calling operator++ step times.
advance iterator
Definition at line 77 of file Range.cpp.
{ // Check negative now to avoid infinite loop below. if (sstep < 0) { return operator-=( -sstep ); } EntityHandle step = sstep; // Handle current PairNode. Either step is within the current // node or need to remove the remainder of the current node // from step. EntityHandle this_node_rem = mNode->second - mValue; if (this_node_rem >= step) { mValue += step; return *this; } step -= this_node_rem + 1; // For each node we are stepping past, decrement step // by the size of the node. PairNode* node = mNode->mNext; EntityHandle node_size = node->second - node->first + 1; while (step >= node_size) { step -= node_size; node = node->mNext; node_size = node->second - node->first + 1; } // Advance into the resulting node by whatever is // left in step. mNode = node; mValue = mNode->first + step; return *this; }
const_iterator& moab::Range::const_iterator::operator-- | ( | ) | [inline] |
const_iterator moab::Range::const_iterator::operator-- | ( | int | ) | [inline] |
postfix decrementer
Definition at line 502 of file Range.hpp.
{ // make a copy of this const_iterator tmp(*this); // decrement self this->operator --(); // return the copy return tmp; }
Range::const_iterator & moab::Range::const_iterator::operator-= | ( | EntityID | sstep | ) |
Regress iterator specified amount. Potentially O(n), but typically better. Always more efficient than calling operator-- step times.
regress iterator
Definition at line 120 of file Range.cpp.
{ // Check negative now to avoid infinite loop below. if (sstep < 0) { return operator+=( -sstep ); } EntityHandle step = sstep; // Handle current PairNode. Either step is within the current // node or need to remove the remainder of the current node // from step. EntityHandle this_node_rem = mValue - mNode->first; if (this_node_rem >= step) { mValue -= step; return *this; } step -= this_node_rem + 1; // For each node we are stepping past, decrement step // by the size of the node. PairNode* node = mNode->mPrev; EntityHandle node_size = node->second - node->first + 1; while (step >= node_size) { step -= node_size; node = node->mPrev; node_size = node->second - node->first + 1; } // Advance into the resulting node by whatever is // left in step. mNode = node; mValue = mNode->second - step; return *this; }
bool moab::Range::const_iterator::operator== | ( | const const_iterator & | other | ) | const [inline] |
Range::const_iterator moab::Range::const_iterator::start_of_block | ( | ) | const [inline] |
get an iterator at the start of the block
Get an iterator at the start of the block of consecutive handles that this iterator is currently contained in. That is, if the range contains blocks of consecutive handles of the form { [1,5], [7,100], ... } and this iterator is at any handle in the range [7,100], return an iterator at the '7' handle.
Never returns end() unless this iterator is at end(). May return the same location as this iterator.
Definition at line 819 of file Range.hpp.
{ return Range::const_iterator( mNode, mNode->first ); }
friend class const_pair_iterator [friend] |
EntityID operator- | ( | const const_iterator & | it1, |
const const_iterator & | it2 | ||
) | [friend] |
friend class pair_iterator [friend] |
PairNode* moab::Range::const_iterator::mNode [protected] |
EntityHandle moab::Range::const_iterator::mValue [protected] |