41 #include "DTK_EntityIterator.hpp" 49 : b_iterator_impl( nullptr )
52 b_predicate = [](
Entity v ) {
return true; };
59 b_iterator_impl.reset();
60 if ( rhs.b_iterator_impl )
62 b_iterator_impl = std::move( rhs.b_iterator_impl->clone() );
63 b_predicate = b_iterator_impl->b_predicate;
67 b_iterator_impl = std::move( rhs.clone() );
68 b_predicate = rhs.b_predicate;
76 b_iterator_impl.reset();
81 if ( rhs.b_iterator_impl )
83 b_iterator_impl = std::move( rhs.b_iterator_impl->clone() );
84 b_predicate = b_iterator_impl->b_predicate;
88 b_iterator_impl = std::move( rhs.clone() );
89 b_predicate = rhs.b_predicate;
101 DTK_REQUIRE( b_iterator_impl );
102 DTK_REQUIRE( *b_iterator_impl != b_iterator_impl->end() );
105 return *b_iterator_impl;
112 DTK_REQUIRE( b_iterator_impl );
113 DTK_REQUIRE( *b_iterator_impl != b_iterator_impl->end() );
122 Entity &EntityIterator::operator*(
void )
124 DTK_REQUIRE( b_iterator_impl );
125 return b_iterator_impl->operator*();
130 Entity *EntityIterator::operator->(
void )
132 DTK_REQUIRE( b_iterator_impl );
133 return b_iterator_impl->operator->();
138 bool EntityIterator::operator==(
const EntityIterator &rhs )
const 140 if (
nullptr == b_iterator_impl )
141 return (
nullptr == b_iterator_impl );
142 return b_iterator_impl->operator==( rhs );
147 bool EntityIterator::operator!=(
const EntityIterator &rhs )
const 149 return !( b_iterator_impl->operator==( rhs ) );
155 std::size_t EntityIterator::size()
const 157 std::size_t size = 0;
158 if ( b_iterator_impl )
160 size = std::distance( this->begin(), this->end() );
170 if ( b_iterator_impl )
172 begin_it = b_iterator_impl->begin();
173 begin_it.b_predicate = b_predicate;
174 begin_it.advanceToFirstValidElement();
183 if ( b_iterator_impl )
185 return b_iterator_impl->end();
192 std::unique_ptr<EntityIterator> EntityIterator::clone()
const 200 void EntityIterator::advanceToFirstValidElement()
202 DTK_REQUIRE( b_iterator_impl );
203 if ( ( *
this != end() ) && !b_predicate( **
this ) )
212 void EntityIterator::increment()
214 DTK_REQUIRE( b_iterator_impl );
215 DTK_REQUIRE( *b_iterator_impl != b_iterator_impl->end() );
226 while ( it != end && !b_predicate( *it ) )
228 it = b_iterator_impl->operator++();
Geometric entity interface definition.
Entity iterator interface.
EntityIterator & operator=(const EntityIterator &rhs)
Assignment operator.
Assertions and Design-by-Contract for error handling.
virtual ~EntityIterator()
Destructor.
EntityIterator()
Constructor.