a const iterator which iterates over an Range
More...
#include <Range.hpp >
a const iterator which iterates over an Range
Examples ComputeTriDual.cpp .
Definition at line 459 of file Range.hpp .
◆ const_iterator() [1/2]
moab::Range::const_iterator::const_iterator
(
)
inline
default constructor - intialize base default constructor
Definition at line 468 of file Range.hpp .
468 : mNode ( NULL ), mValue ( 0 ) {}
◆ const_iterator() [2/2]
constructor used by Range
Definition at line 471 of file Range.hpp .
472 : mNode( const_cast< PairNode* >( iter ) ), mValue( val )
473 {
474 }
◆ end_of_block()
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 .
897 {
898 return Range ::const_iterator( mNode, mNode->second );
899 }
References 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() .
◆ operator!=()
bool moab::Range::const_iterator::operator!=
(
const const_iterator &
other )
const
inline
not equals operator
Definition at line 555 of file Range.hpp .
556 {
557
558 return ( mNode != other.mNode ) || ( mValue != other.mValue );
559 }
References mNode , and mValue .
◆ operator*()
const EntityHandle & moab::Range::const_iterator::operator*
(
)
const
inline
dereference that value this iterator points to returns a const reference
Definition at line 478 of file Range.hpp .
479 {
480 return mValue;
481 }
◆ operator++() [1/2]
prefix incrementer
Definition at line 484 of file Range.hpp .
485 {
486
487 if ( mValue == mNode->second )
488 {
489 mNode = mNode->mNext;
490 mValue = mNode->first;
491 }
492
493 else
494 ++mValue;
495 return *this ;
496 }
◆ operator++() [2/2]
postfix incrementer
Definition at line 499 of file Range.hpp .
500 {
501
502 const_iterator tmp ( *this ) ;
503
504 this ->operator ++();
505
506 return tmp;
507 }
References moab::operator++() .
◆ operator+=()
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 .
93 {
94
95 if ( sstep < 0 )
96 {
97 return operator -=( -sstep );
98 }
99 EntityHandle step = sstep;
100
101
102
103
104 EntityHandle this_node_rem = mNode->second - mValue;
105 if ( this_node_rem >= step )
106 {
107 mValue += step;
108 return *this ;
109 }
110 step -= this_node_rem + 1 ;
111
112
113
114 PairNode* node = mNode->mNext;
115 EntityHandle node_size = node->second - node->first + 1 ;
116 while ( step >= node_size )
117 {
118 step -= node_size;
119 node = node->mNext;
120 node_size = node->second - node->first + 1 ;
121 }
122
123
124
125 mNode = node;
126 mValue = mNode->first + step;
127 return *this ;
128 }
References moab::Range::PairNode::mNext , mNode , mValue , and operator-=() .
◆ operator--() [1/2]
prefix decrementer
Definition at line 510 of file Range.hpp .
511 {
512
513 if ( mValue == mNode->first )
514 {
515 mNode = mNode->mPrev;
516 ;
517 mValue = mNode->second;
518 }
519
520 else
521 --mValue;
522 return *this ;
523 }
◆ operator--() [2/2]
postfix decrementer
Definition at line 526 of file Range.hpp .
527 {
528
529 const_iterator tmp ( *this ) ;
530
531 this ->operator --();
532
533 return tmp;
534 }
◆ operator-=()
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 .
134 {
135
136 if ( sstep < 0 )
137 {
138 return operator +=( -sstep );
139 }
140 EntityHandle step = sstep;
141
142
143
144
145 EntityHandle this_node_rem = mValue - mNode->first;
146 if ( this_node_rem >= step )
147 {
148 mValue -= step;
149 return *this ;
150 }
151 step -= this_node_rem + 1 ;
152
153
154
155 PairNode* node = mNode->mPrev;
156 EntityHandle node_size = node->second - node->first + 1 ;
157 while ( step >= node_size )
158 {
159 step -= node_size;
160 node = node->mPrev;
161 node_size = node->second - node->first + 1 ;
162 }
163
164
165
166 mNode = node;
167 mValue = mNode->second - step;
168 return *this ;
169 }
References moab::Range::PairNode::mPrev .
Referenced by operator+=() .
◆ operator==()
bool moab::Range::const_iterator::operator==
(
const const_iterator &
other )
const
inline
equals operator
Definition at line 547 of file Range.hpp .
548 {
549
550
551 return ( mNode == other.mNode ) && ( mValue == other.mValue );
552 }
References mNode , and mValue .
◆ start_of_block()
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 .
902 {
903 return Range ::const_iterator( mNode, mNode->first );
904 }
Referenced by moab::ReadHDF5VarLen::read_offsets() .
◆ const_pair_iterator
◆ operator-
Definition at line 793 of file Range.cpp .
794 {
795 assert ( !it2.mValue || *it2 >= *it1 );
796 if ( it2.mNode == it1.mNode )
797 {
798 return *it2 - *it1;
799 }
800
801 EntityID result = it1.mNode->second - it1.mValue + 1 ;
802 for ( Range::PairNode* n = it1.mNode->mNext; n != it2.mNode; n = n->mNext )
803 result += n->second - n->first + 1 ;
804 if ( it2.mValue )
805 result += it2.mValue - it2.mNode->first;
806 return result;
807 }
◆ pair_iterator
◆ Range
◆ mNode
PairNode * moab::Range::const_iterator::mNode
protected
◆ mValue
The documentation for this class was generated from the following files: