Walks over a container as if it were circular. The container must have the following members defined: More...
Public Types | |
typedef ContainerType::value_type | value_type |
Type of values ContainerType contains. More... | |
typedef ContainerType::size_type | size_type |
The type that can represent the size of ContainerType. More... | |
typedef ContainerType::difference_type | difference_type |
The type that can represent the difference between any two. More... | |
typedef ContainerType::iterator | iterator |
Random access iterator for traversing ContainerType. More... | |
typedef ContainerType::reference | reference |
Type that can be used for storing into. More... | |
Public Types inherited from CirculatorBase | |
enum | direction { none, clockwise, anticlockwise } |
Direction type enumeration. More... | |
Public Member Functions | |
Circulator () | |
Construct null. More... | |
Circulator (ContainerType &container) | |
Construct from a container. More... | |
Circulator (const iterator &begin, const iterator &end) | |
Construct from two iterators. More... | |
Circulator (const Circulator< ContainerType > &) | |
Copy constructor. More... | |
~Circulator () | |
Destructor. More... | |
size_type | size () const |
Return the range of the iterator. More... | |
bool | circulate (const CirculatorBase::direction dir=CirculatorBase::direction::none) |
Circulate around the list in the given direction. More... | |
void | setFulcrumToIterator () |
Set the fulcrum to the current position of the iterator. More... | |
void | setIteratorToFulcrum () |
Set the iterator to the current position of the fulcrum. More... | |
difference_type | nRotations () const |
Return the distance between the iterator and the fulcrum. This is. More... | |
reference | next () const |
Dereference the next iterator and return. More... | |
reference | prev () const |
Dereference the previous iterator and return. More... | |
void | operator= (const Circulator< ContainerType > &) |
Assignment operator for Circulators that operate on the same. More... | |
Circulator< ContainerType > & | operator++ () |
Prefix increment. Increments the iterator. More... | |
Circulator< ContainerType > | operator++ (int) |
Postfix increment. Increments the iterator. More... | |
Circulator< ContainerType > & | operator-- () |
Prefix decrement. Decrements the iterator. More... | |
Circulator< ContainerType > | operator-- (int) |
Postfix decrement. Decrements the iterator. More... | |
bool | operator== (const Circulator< ContainerType > &c) const |
Check for equality of this iterator with another iterator that. More... | |
bool | operator!= (const Circulator< ContainerType > &c) const |
Check for inequality of this iterator with another iterator that. More... | |
reference | operator* () const |
Dereference the iterator and return. More... | |
reference | operator() () const |
Dereference the iterator and return. More... | |
difference_type | operator- (const Circulator< ContainerType > &c) const |
Return the difference between this iterator and another iterator. More... | |
Public Member Functions inherited from CirculatorBase | |
CirculatorBase () | |
Construct null. More... | |
Protected Attributes | |
ContainerType::iterator | begin_ |
Iterator pointing to the beginning of the container. More... | |
ContainerType::iterator | end_ |
Iterator pointing to the end of the container. More... | |
ContainerType::iterator | iter_ |
Random access iterator for traversing ContainerType. More... | |
ContainerType::iterator | fulcrum_ |
Iterator holding the location of the fulcrum (start and end) of. More... | |
Walks over a container as if it were circular. The container must have the following members defined:
Examples
Definition at line 75 of file Circulator.H.
typedef ContainerType::value_type value_type |
Type of values ContainerType contains.
Definition at line 104 of file Circulator.H.
typedef ContainerType::size_type size_type |
The type that can represent the size of ContainerType.
Definition at line 107 of file Circulator.H.
typedef ContainerType::difference_type difference_type |
The type that can represent the difference between any two.
iterator objects.
Definition at line 111 of file Circulator.H.
typedef ContainerType::iterator iterator |
Random access iterator for traversing ContainerType.
Definition at line 114 of file Circulator.H.
typedef ContainerType::reference reference |
Type that can be used for storing into.
ContainerType::value_type objects.
Definition at line 118 of file Circulator.H.
|
inline |
Construct null.
Definition at line 29 of file CirculatorI.H.
Referenced by Circulator< ContainerType >::Circulator().
|
inlineexplicit |
Construct from a container.
Definition at line 40 of file CirculatorI.H.
References Circulator< ContainerType >::Circulator().
|
inline |
Construct from two iterators.
Definition at line 52 of file CirculatorI.H.
References Circulator< ContainerType >::Circulator().
|
inline |
Copy constructor.
Definition at line 67 of file CirculatorI.H.
~Circulator | ( | ) |
Destructor.
Definition at line 82 of file CirculatorI.H.
|
inline |
Return the range of the iterator.
Definition at line 90 of file CirculatorI.H.
References Circulator< ContainerType >::begin_, Circulator< ContainerType >::circulate(), and Circulator< ContainerType >::end_.
|
inline |
Circulate around the list in the given direction.
Definition at line 98 of file CirculatorI.H.
References CirculatorBase::anticlockwise, CirculatorBase::clockwise, Circulator< ContainerType >::fulcrum_, Circulator< ContainerType >::iter_, Circulator< ContainerType >::operator++(), and Circulator< ContainerType >::operator--().
Referenced by Circulator< ContainerType >::size().
|
inline |
Set the fulcrum to the current position of the iterator.
Definition at line 116 of file CirculatorI.H.
References Circulator< ContainerType >::fulcrum_, and Circulator< ContainerType >::iter_.
|
inline |
Set the iterator to the current position of the fulcrum.
Definition at line 123 of file CirculatorI.H.
References Circulator< ContainerType >::fulcrum_, and Circulator< ContainerType >::iter_.
|
inline |
Return the distance between the iterator and the fulcrum. This is.
equivalent to the number of rotations of the Circulator.
Definition at line 131 of file CirculatorI.H.
References Circulator< ContainerType >::fulcrum_, and Circulator< ContainerType >::iter_.
|
inline |
Dereference the next iterator and return.
Definition at line 139 of file CirculatorI.H.
References Circulator< ContainerType >::begin_, Circulator< ContainerType >::end_, and Circulator< ContainerType >::iter_.
|
inline |
Dereference the previous iterator and return.
Definition at line 152 of file CirculatorI.H.
References Circulator< ContainerType >::begin_, Circulator< ContainerType >::end_, and Circulator< ContainerType >::iter_.
|
inline |
Assignment operator for Circulators that operate on the same.
container type
Definition at line 167 of file CirculatorI.H.
References Foam::abort(), Circulator< ContainerType >::begin_, Circulator< ContainerType >::end_, Foam::FatalError, FatalErrorInFunction, Circulator< ContainerType >::fulcrum_, and Circulator< ContainerType >::iter_.
|
inline |
Prefix increment. Increments the iterator.
Sets the iterator to the beginning of the container if it reaches the end
Definition at line 188 of file CirculatorI.H.
References Circulator< ContainerType >::begin_, Circulator< ContainerType >::end_, and Circulator< ContainerType >::iter_.
Referenced by Circulator< ContainerType >::circulate().
|
inline |
Postfix increment. Increments the iterator.
Sets the iterator to the beginning of the container if it reaches the end
Definition at line 202 of file CirculatorI.H.
|
inline |
Prefix decrement. Decrements the iterator.
Sets the iterator to the end of the container if it reaches the beginning
Definition at line 212 of file CirculatorI.H.
References Circulator< ContainerType >::begin_, Circulator< ContainerType >::end_, and Circulator< ContainerType >::iter_.
Referenced by Circulator< ContainerType >::circulate().
|
inline |
Postfix decrement. Decrements the iterator.
Sets the iterator to the end of the container if it reaches the beginning
Definition at line 226 of file CirculatorI.H.
|
inline |
Check for equality of this iterator with another iterator that.
operate on the same container type
Definition at line 236 of file CirculatorI.H.
References Circulator< ContainerType >::begin_, Foam::constant::universal::c, Circulator< ContainerType >::end_, Circulator< ContainerType >::fulcrum_, and Circulator< ContainerType >::iter_.
|
inline |
Check for inequality of this iterator with another iterator that.
operate on the same container type
Definition at line 252 of file CirculatorI.H.
References Foam::constant::universal::c.
|
inline |
Dereference the iterator and return.
Definition at line 262 of file CirculatorI.H.
References Circulator< ContainerType >::iter_.
Referenced by Circulator< ContainerType >::operator()().
|
inline |
Dereference the iterator and return.
Definition at line 270 of file CirculatorI.H.
References Circulator< ContainerType >::operator*().
|
inline |
Return the difference between this iterator and another iterator.
that operate on the same container type
Definition at line 279 of file CirculatorI.H.
References Foam::constant::universal::c, and Circulator< ContainerType >::iter_.
|
protected |
Iterator pointing to the beginning of the container.
Definition at line 85 of file Circulator.H.
Referenced by Circulator< ContainerType >::next(), Circulator< ContainerType >::operator++(), Circulator< ContainerType >::operator--(), Circulator< ContainerType >::operator=(), Circulator< ContainerType >::operator==(), Circulator< ContainerType >::prev(), and Circulator< ContainerType >::size().
|
protected |
Iterator pointing to the end of the container.
Definition at line 88 of file Circulator.H.
Referenced by Circulator< ContainerType >::next(), Circulator< ContainerType >::operator++(), Circulator< ContainerType >::operator--(), Circulator< ContainerType >::operator=(), Circulator< ContainerType >::operator==(), Circulator< ContainerType >::prev(), and Circulator< ContainerType >::size().
|
protected |
Random access iterator for traversing ContainerType.
Definition at line 91 of file Circulator.H.
Referenced by Circulator< ContainerType >::circulate(), Circulator< ContainerType >::next(), Circulator< ContainerType >::nRotations(), Circulator< ContainerType >::operator*(), Circulator< ContainerType >::operator++(), Circulator< ContainerType >::operator-(), Circulator< ContainerType >::operator--(), Circulator< ContainerType >::operator=(), Circulator< ContainerType >::operator==(), Circulator< ContainerType >::prev(), Circulator< ContainerType >::setFulcrumToIterator(), and Circulator< ContainerType >::setIteratorToFulcrum().
|
protected |
Iterator holding the location of the fulcrum (start and end) of.
the container. Used to decide when the iterator should stop circulating over the container
Definition at line 96 of file Circulator.H.
Referenced by Circulator< ContainerType >::circulate(), Circulator< ContainerType >::nRotations(), Circulator< ContainerType >::operator=(), Circulator< ContainerType >::operator==(), Circulator< ContainerType >::setFulcrumToIterator(), and Circulator< ContainerType >::setIteratorToFulcrum().