ConstCirculator< ContainerType > Class Template Reference

Walks over a container as if it were circular. The container must have the following members defined: More...

Inheritance diagram for ConstCirculator< ContainerType >:
[legend]
Collaboration diagram for ConstCirculator< ContainerType >:
[legend]

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::const_iterator const_iterator
 Random access iterator for traversing ContainerType. More...
 
typedef ContainerType::const_reference const_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

 ConstCirculator ()
 Construct null. More...
 
 ConstCirculator (const ContainerType &container)
 Construct from a container. More...
 
 ConstCirculator (const const_iterator &begin, const const_iterator &end)
 Construct from two iterators. More...
 
 ConstCirculator (const ConstCirculator< ContainerType > &)
 Construct as copy. More...
 
 ~ConstCirculator ()
 Destructor. More...
 
size_type size () const
 Return the range of the iterator. More...
 
bool circulate (const CirculatorBase::direction dir=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...
 
const_reference next () const
 Dereference the next iterator and return. More...
 
const_reference prev () const
 Dereference the previous iterator and return. More...
 
void operator= (const ConstCirculator< ContainerType > &)
 Assignment operator for circulators that operate on the same. More...
 
ConstCirculator< ContainerType > & operator++ ()
 Prefix increment. Increments the iterator. More...
 
ConstCirculator< ContainerType > operator++ (int)
 Postfix increment. Increments the iterator. More...
 
ConstCirculator< ContainerType > & operator-- ()
 Prefix decrement. Decrements the iterator. More...
 
ConstCirculator< ContainerType > operator-- (int)
 Postfix decrement. Decrements the iterator. More...
 
bool operator== (const ConstCirculator< ContainerType > &c) const
 Check for equality of this iterator with another iterator that. More...
 
bool operator!= (const ConstCirculator< ContainerType > &c) const
 Check for inequality of this iterator with another iterator that. More...
 
const_reference operator* () const
 Dereference the iterator and return. More...
 
const_reference operator() () const
 Dereference the iterator and return. More...
 
difference_type operator- (const ConstCirculator< 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::const_iterator begin_
 Iterator pointing to the beginning of the container. More...
 
ContainerType::const_iterator end_
 Iterator pointing to the end of the container. More...
 
ContainerType::const_iterator iter_
 Iterator. More...
 
ContainerType::const_iterator fulcrum_
 Iterator holding the location of the fulcrum (start and end) of. More...
 

Detailed Description

template<class ContainerType>
class Foam::ConstCirculator< ContainerType >

Walks over a container as if it were circular. The container must have the following members defined:

- value_type

  • size_type
  • difference_type
  • const_iterator
  • const_reference

Examples:

face f(identity(5));
// Construct circulator from the face
ConstCirculator<face> circ(f);
// First check that the circulator has a size to iterate over.
// Then circulate around the list starting and finishing at the fulcrum.
if (circ.size()) do
{
Info<< "Iterate forwards over face : " << circ() << endl;
} while (circ.circulate(CirculatorBase::CLOCKWISE));
face f(identity(5));
ConstCirculator<face> circClockwise(f);
ConstCirculator<face> circAnticlockwise(f);
if (circClockwise.size() && circAnticlockwise.size()) do
{
Info<< "Iterate forward over face :" << circClockwise() << endl;
Info<< "Iterate backward over face:" << circAnticlockwise() << endl;
}
while
(
circClockwise.circulate(CirculatorBase::CLOCKWISE),
circAnticlockwise.circulate(CirculatorBase::ANTICLOCKWISE)
);
Source files

Definition at line 93 of file ConstCirculator.H.

Member Typedef Documentation

◆ value_type

typedef ContainerType::value_type value_type

Type of values ContainerType contains.

Definition at line 122 of file ConstCirculator.H.

◆ size_type

typedef ContainerType::size_type size_type

The type that can represent the size of ContainerType.

Definition at line 125 of file ConstCirculator.H.

◆ difference_type

typedef ContainerType::difference_type difference_type

The type that can represent the difference between any two.

iterator objects.

Definition at line 129 of file ConstCirculator.H.

◆ const_iterator

typedef ContainerType::const_iterator const_iterator

Random access iterator for traversing ContainerType.

Definition at line 132 of file ConstCirculator.H.

◆ const_reference

typedef ContainerType::const_reference const_reference

Type that can be used for storing into.

const ContainerType::value_type objects.

Definition at line 136 of file ConstCirculator.H.

Constructor & Destructor Documentation

◆ ConstCirculator() [1/4]

ConstCirculator ( )
inline

Construct null.

Definition at line 34 of file ConstCirculatorI.H.

◆ ConstCirculator() [2/4]

ConstCirculator ( const ContainerType &  container)
inlineexplicit

Construct from a container.

Definition at line 46 of file ConstCirculatorI.H.

◆ ConstCirculator() [3/4]

ConstCirculator ( const const_iterator begin,
const const_iterator end 
)
inline

Construct from two iterators.

Definition at line 60 of file ConstCirculatorI.H.

◆ ConstCirculator() [4/4]

ConstCirculator ( const ConstCirculator< ContainerType > &  rhs)
inline

Construct as copy.

Definition at line 75 of file ConstCirculatorI.H.

◆ ~ConstCirculator()

Destructor.

Definition at line 90 of file ConstCirculatorI.H.

Member Function Documentation

◆ size()

Foam::ConstCirculator< ContainerType >::size_type size ( ) const
inline

Return the range of the iterator.

Definition at line 98 of file ConstCirculatorI.H.

◆ circulate()

bool circulate ( const CirculatorBase::direction  dir = NONE)
inline

Circulate around the list in the given direction.

Definition at line 106 of file ConstCirculatorI.H.

References CirculatorBase::ANTICLOCKWISE, and CirculatorBase::CLOCKWISE.

Referenced by face::compare(), and processorPolyPatch::matchFace().

Here is the caller graph for this function:

◆ setFulcrumToIterator()

void setFulcrumToIterator ( )
inline

Set the fulcrum to the current position of the iterator.

Definition at line 124 of file ConstCirculatorI.H.

Referenced by face::compare(), and processorPolyPatch::matchFace().

Here is the caller graph for this function:

◆ setIteratorToFulcrum()

void setIteratorToFulcrum ( )
inline

Set the iterator to the current position of the fulcrum.

Definition at line 131 of file ConstCirculatorI.H.

Referenced by face::compare(), and processorPolyPatch::matchFace().

Here is the caller graph for this function:

◆ nRotations()

Foam::ConstCirculator< ContainerType >::difference_type nRotations ( ) const
inline

Return the distance between the iterator and the fulcrum. This is.

equivalent to the number of rotations of the circulator.

Definition at line 139 of file ConstCirculatorI.H.

Referenced by processorPolyPatch::matchFace().

Here is the caller graph for this function:

◆ next()

Foam::ConstCirculator< ContainerType >::const_reference next ( ) const
inline

Dereference the next iterator and return.

Definition at line 147 of file ConstCirculatorI.H.

◆ prev()

Foam::ConstCirculator< ContainerType >::const_reference prev ( ) const
inline

Dereference the previous iterator and return.

Definition at line 160 of file ConstCirculatorI.H.

◆ operator=()

void operator= ( const ConstCirculator< ContainerType > &  rhs)
inline

Assignment operator for circulators that operate on the same.

container type

Definition at line 175 of file ConstCirculatorI.H.

References ConstCirculator< ContainerType >::begin_, ConstCirculator< ContainerType >::end_, ConstCirculator< ContainerType >::fulcrum_, and ConstCirculator< ContainerType >::iter_.

◆ operator++() [1/2]

Foam::ConstCirculator< ContainerType > & operator++ ( )
inline

Prefix increment. Increments the iterator.

Sets the iterator to the beginning of the container if it reaches the end

Definition at line 193 of file ConstCirculatorI.H.

◆ operator++() [2/2]

Foam::ConstCirculator< ContainerType > operator++ ( int  )
inline

Postfix increment. Increments the iterator.

Sets the iterator to the beginning of the container if it reaches the end

Definition at line 207 of file ConstCirculatorI.H.

◆ operator--() [1/2]

Foam::ConstCirculator< ContainerType > & operator-- ( )
inline

Prefix decrement. Decrements the iterator.

Sets the iterator to the end of the container if it reaches the beginning

Definition at line 217 of file ConstCirculatorI.H.

◆ operator--() [2/2]

Foam::ConstCirculator< ContainerType > operator-- ( int  )
inline

Postfix decrement. Decrements the iterator.

Sets the iterator to the end of the container if it reaches the beginning

Definition at line 231 of file ConstCirculatorI.H.

◆ operator==()

bool operator== ( const ConstCirculator< ContainerType > &  c) const
inline

Check for equality of this iterator with another iterator that.

operate on the same container type

Definition at line 241 of file ConstCirculatorI.H.

References Foam::constant::universal::c.

◆ operator!=()

bool operator!= ( const ConstCirculator< ContainerType > &  c) const
inline

Check for inequality of this iterator with another iterator that.

operate on the same container type

Definition at line 257 of file ConstCirculatorI.H.

References Foam::constant::universal::c.

◆ operator*()

Foam::ConstCirculator< ContainerType >::const_reference operator* ( ) const
inline

Dereference the iterator and return.

Definition at line 267 of file ConstCirculatorI.H.

◆ operator()()

Foam::ConstCirculator< ContainerType >::const_reference operator() ( ) const
inline

Dereference the iterator and return.

Definition at line 275 of file ConstCirculatorI.H.

References Foam::operator*().

Here is the call graph for this function:

◆ operator-()

Foam::ConstCirculator< ContainerType >::difference_type operator- ( const ConstCirculator< ContainerType > &  c) const
inline

Return the difference between this iterator and another iterator.

that operate on the same container type

Definition at line 284 of file ConstCirculatorI.H.

References Foam::constant::universal::c.

Member Data Documentation

◆ begin_

ContainerType::const_iterator begin_
protected

Iterator pointing to the beginning of the container.

Definition at line 103 of file ConstCirculator.H.

Referenced by ConstCirculator< ContainerType >::operator=().

◆ end_

ContainerType::const_iterator end_
protected

Iterator pointing to the end of the container.

Definition at line 106 of file ConstCirculator.H.

Referenced by ConstCirculator< ContainerType >::operator=().

◆ iter_

ContainerType::const_iterator iter_
protected

Iterator.

Definition at line 109 of file ConstCirculator.H.

Referenced by ConstCirculator< ContainerType >::operator=().

◆ fulcrum_

ContainerType::const_iterator fulcrum_
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 114 of file ConstCirculator.H.

Referenced by ConstCirculator< ContainerType >::operator=().


The documentation for this class was generated from the following files:
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::CirculatorBase::CLOCKWISE
Definition: CirculatorBase.H:56
f
labelList f(nPoints)
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::CirculatorBase::ANTICLOCKWISE
Definition: CirculatorBase.H:57