MOAB: Mesh Oriented datABase
(version 5.4.1)
|
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] |
default constructor - intialize base default constructor
Definition at line 468 of file Range.hpp.
Referenced by end_of_block().
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 896 of file Range.hpp.
References const_iterator(), and mNode.
Referenced by moab::Core::adjacencies_iterate(), moab::Core::connect_iterate(), moab::Core::coords_iterate(), moab::BitTag::get_entities_with_bits(), moab::BitTag::get_tagged(), moab::ReadHDF5Dataset::next_end(), moab::ReadHDF5Dataset::read(), and moab::DenseTag::tag_iterate().
{ 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 499 of file Range.hpp.
References moab::operator++().
{ // 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 92 of file Range.cpp.
References moab::Range::PairNode::mNext, mNode, mValue, and operator-=().
{ // 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 526 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 133 of file Range.cpp.
References moab::Range::PairNode::mPrev.
Referenced by operator+=().
{ // 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 901 of file Range.hpp.
Referenced by moab::ReadHDF5VarLen::read_offsets().
{ 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] |
the node we are pointing at
Definition at line 593 of file Range.hpp.
Referenced by end_of_block(), moab::Range::erase(), moab::Range::insert(), moab::Range::lower_bound(), operator!=(), operator+=(), moab::operator-(), and operator==().
EntityHandle moab::Range::const_iterator::mValue [protected] |
the value in the range
Definition at line 595 of file Range.hpp.
Referenced by moab::Range::erase(), operator!=(), operator+=(), moab::operator-(), and operator==().