Circulator< Container > Class Template Reference

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

Inheritance diagram for Circulator< Container >:
[legend]
Collaboration diagram for Circulator< Container >:
[legend]

Public Member Functions

 Circulator ()=default
 Default construct. More...
 
 Circulator (Container &obj)
 Construct from begin/end of a container. More...
 
 Circulator (const typename Container::iterator &begin, const typename Container::iterator &end)
 Construct from two iterators. More...
 
 Circulator (const Circulator< Container > &rhs)=default
 Copy construct. More...
 
Circulator< Container > & operator= (const Circulator< Container > &rhs)=default
 Copy assignment. More...
 
- Public Member Functions inherited from CirculatorIters< Container, false >
 CirculatorIters ()
 Default construct. More...
 
 CirculatorIters (const iterator &begin, const iterator &end)
 Construct from begin/end iterators. More...
 
 CirculatorIters (const CirculatorIters< Container, Const > &rhs)
 Copy construct. More...
 
bool empty () const
 True if begin/end iterators are identical. More...
 
size_type size () const
 Return the range of the iterator pair. More...
 
difference_type nRotations () const
 The distance between the iterator and the fulcrum. More...
 
bool circulate (const CirculatorBase::direction dir=CirculatorBase::NONE)
 
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...
 
reference curr () const
 Dereference the current iterator. More...
 
reference next () const
 Dereference the next iterator. More...
 
reference prev () const
 Dereference the previous iterator. More...
 
void operator= (const CirculatorIters< Container, Const > &rhs)
 
CirculatorIters< Container, Const > & operator++ ()
 Prefix increment the iterator. More...
 
CirculatorIters< Container, Const > operator++ (int)
 Postfix increment the iterator. More...
 
CirculatorIters< Container, Const > & operator-- ()
 Prefix decrement the iterator. More...
 
CirculatorIters< Container, Const > operator-- (int)
 Postfix decrement the iterator. More...
 
bool operator== (const CirculatorIters< Container, Const > &) const
 
bool operator!= (const CirculatorIters< Container, Const > &) const
 
reference operator* () const
 Dereference the iterator. Same as curr() More...
 
reference operator() () const
 Dereference the iterator. Same as curr() More...
 
difference_type operator- (const CirculatorIters< Container, Const > &) const
 
- Public Member Functions inherited from CirculatorBase
 CirculatorBase ()=default
 Default construct. More...
 

Additional Inherited Members

- Public Types inherited from CirculatorIters< Container, false >
using size_type = typename Container::size_type
 The type that can represent the size of Container. More...
 
using difference_type = typename Container::difference_type
 The type that represents difference between iterator objects. More...
 
using iterator = typename std::conditional< Const, typename Container::const_iterator, typename Container::iterator >::type
 The container iterator type (const/non-const) More...
 
using reference = typename std::conditional< Const, typename Container::const_reference, typename Container::reference >::type
 The reference type (const/non-const) More...
 
- Public Types inherited from CirculatorBase
enum  direction { NONE , CLOCKWISE , ANTICLOCKWISE }
 Direction type enumeration. More...
 
- Protected Member Functions inherited from CirculatorIters< Container, false >
bool equal (const CirculatorIters< Container, Const > &rhs)
 Compare for equality. More...
 
void increment ()
 Move iterator forward. More...
 
void decrement ()
 Move iterator backward. More...
 

Detailed Description

template<class Container>
class Foam::Circulator< Container >

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

- size_type

  • difference_type
  • iterator / const_iterator
  • reference / const_reference

Examples

// Construct Circulator from the face
// If it has a size to iterate over,
// circulate around the list starting and finishing at the fulcrum.
if (!circ.empty())
{
do
{
*circ += 1;
Info<< "Iterate forwards over face : " << *circ << endl;
} while (circ.circulate(CirculatorBase::FORWARD));
}
Walks over a container as if it were circular. The container must have the following members defined:
Definition: Circulator.H:279
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
Definition: labelList.C:38
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
labelList f(nPoints)
Source files

Definition at line 276 of file Circulator.H.

Constructor & Destructor Documentation

◆ Circulator() [1/4]

Circulator ( )
default

Default construct.

◆ Circulator() [2/4]

Circulator ( Container &  obj)
inlineexplicit

Construct from begin/end of a container.

Definition at line 288 of file Circulator.H.

◆ Circulator() [3/4]

Circulator ( const typename Container::iterator &  begin,
const typename Container::iterator &  end 
)
inline

Construct from two iterators.

Definition at line 294 of file Circulator.H.

◆ Circulator() [4/4]

Circulator ( const Circulator< Container > &  rhs)
default

Copy construct.

Member Function Documentation

◆ operator=()

Circulator< Container > & operator= ( const Circulator< Container > &  rhs)
default

Copy assignment.


The documentation for this class was generated from the following file: