walberla::pe::RigidBodyIterator Class Reference

Detailed Description

Implementation of an iterator for pointer vectors.

This iterator implementation will automatically dereference twice at dereference calls! Therefore the return types are not unique_ptrs but RigidBodys.

#include <RigidBodyIterator.h>

Public Types

using ContainerType = std::vector< std::unique_ptr< RigidBody > >
 
using iterator_category = std::random_access_iterator_tag
 
using value_type = RigidBody
 
using pointer = RigidBody *
 
using reference = RigidBody &
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

Constructors
 RigidBodyIterator ()=default
 
 RigidBodyIterator (const typename ContainerType::iterator &it)
 
 RigidBodyIterator (const RigidBodyIterator &it)=default
 
 RigidBodyIterator (RigidBodyIterator &&it)=default
 
RigidBodyIteratoroperator= (const RigidBodyIterator &it)=default
 
RigidBodyIteratoroperator= (RigidBodyIterator &&it)=default
 
Operators
RigidBodyIteratoroperator++ ()
 
RigidBodyIterator operator++ (int)
 
RigidBodyIteratoroperator-- ()
 
RigidBodyIterator operator-- (int)
 
RigidBodyIteratoroperator+= (difference_type n)
 
RigidBodyIterator operator+ (difference_type n) const
 
RigidBodyIteratoroperator-= (difference_type n)
 
RigidBodyIterator operator- (difference_type n) const
 
difference_type operator- (const RigidBodyIterator &it) const
 
Access operators
reference operator[] (difference_type n) const
 
reference operator* () const
 
pointer operator-> () const
 
Utility functions
pointer getBodyID ()
 
ContainerType::iterator get () const
 

Private Attributes

Member variables
ContainerType::iterator it_
 wrapped iterator More...
 

Friends

bool operator== (const RigidBodyIterator &lhs, const RigidBodyIterator &rhs)
 Equality comparison between two PtrIterator objects. More...
 
bool operator!= (const RigidBodyIterator &lhs, const RigidBodyIterator &rhs)
 Inequality comparison between two PtrIterator objects. More...
 
bool operator> (const RigidBodyIterator &lhs, const RigidBodyIterator &rhs)
 Greater-than comparison between two PtrIterator objects. More...
 
bool operator< (const RigidBodyIterator &lhs, const RigidBodyIterator &rhs)
 Less-than comparison between two PtrIterator objects. More...
 
bool operator>= (const RigidBodyIterator &lhs, const RigidBodyIterator &rhs)
 Greater-or-equal-than comparison between two PtrIterator objects. More...
 
bool operator<= (const RigidBodyIterator &lhs, const RigidBodyIterator &rhs)
 Less-or-equal-than comparison between two PtrIterator objects. More...
 

Member Typedef Documentation

◆ ContainerType

using walberla::pe::RigidBodyIterator::ContainerType = std::vector< std::unique_ptr<RigidBody> >

◆ difference_type

◆ iterator_category

using walberla::pe::RigidBodyIterator::iterator_category = std::random_access_iterator_tag

◆ pointer

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ RigidBodyIterator() [1/4]

walberla::pe::RigidBodyIterator::RigidBodyIterator ( )
inlinedefault

◆ RigidBodyIterator() [2/4]

walberla::pe::RigidBodyIterator::RigidBodyIterator ( const typename ContainerType::iterator &  it)
inlineexplicit

◆ RigidBodyIterator() [3/4]

walberla::pe::RigidBodyIterator::RigidBodyIterator ( const RigidBodyIterator it)
default

◆ RigidBodyIterator() [4/4]

walberla::pe::RigidBodyIterator::RigidBodyIterator ( RigidBodyIterator &&  it)
default

Member Function Documentation

◆ get()

ContainerType::iterator walberla::pe::RigidBodyIterator::get ( ) const
inline

◆ getBodyID()

pointer walberla::pe::RigidBodyIterator::getBodyID ( )
inline

◆ operator*()

reference walberla::pe::RigidBodyIterator::operator* ( ) const
inline

◆ operator+()

RigidBodyIterator walberla::pe::RigidBodyIterator::operator+ ( difference_type  n) const
inline

◆ operator++() [1/2]

RigidBodyIterator& walberla::pe::RigidBodyIterator::operator++ ( )
inline

◆ operator++() [2/2]

RigidBodyIterator walberla::pe::RigidBodyIterator::operator++ ( int  )
inline

◆ operator+=()

RigidBodyIterator& walberla::pe::RigidBodyIterator::operator+= ( difference_type  n)
inline

◆ operator-() [1/2]

difference_type walberla::pe::RigidBodyIterator::operator- ( const RigidBodyIterator it) const
inline

◆ operator-() [2/2]

RigidBodyIterator walberla::pe::RigidBodyIterator::operator- ( difference_type  n) const
inline

◆ operator--() [1/2]

RigidBodyIterator& walberla::pe::RigidBodyIterator::operator-- ( )
inline

◆ operator--() [2/2]

RigidBodyIterator walberla::pe::RigidBodyIterator::operator-- ( int  )
inline

◆ operator-=()

RigidBodyIterator& walberla::pe::RigidBodyIterator::operator-= ( difference_type  n)
inline

◆ operator->()

pointer walberla::pe::RigidBodyIterator::operator-> ( ) const
inline

◆ operator=() [1/2]

RigidBodyIterator& walberla::pe::RigidBodyIterator::operator= ( const RigidBodyIterator it)
default

◆ operator=() [2/2]

RigidBodyIterator& walberla::pe::RigidBodyIterator::operator= ( RigidBodyIterator &&  it)
default

◆ operator[]()

reference walberla::pe::RigidBodyIterator::operator[] ( difference_type  n) const
inline

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const RigidBodyIterator lhs,
const RigidBodyIterator rhs 
)
friend

Inequality comparison between two PtrIterator objects.

Parameters
lhsThe left-hand side pointer iterator.
rhsThe right-hand side pointer iterator.
Returns
true if the iterators don't point to the same element, false if they do.

◆ operator<

bool operator< ( const RigidBodyIterator lhs,
const RigidBodyIterator rhs 
)
friend

Less-than comparison between two PtrIterator objects.

Parameters
lhsThe left-hand side pointer iterator.
rhsThe right-hand side pointer iterator.
Returns
true if the left-hand side iterator points to a lower element, false if not.

◆ operator<=

bool operator<= ( const RigidBodyIterator lhs,
const RigidBodyIterator rhs 
)
friend

Less-or-equal-than comparison between two PtrIterator objects.

Parameters
lhsThe left-hand side pointer iterator.
rhsThe right-hand side pointer iterator.
Returns
true if the left-hand side iterator points to a lower or the same element, false if not.

◆ operator==

bool operator== ( const RigidBodyIterator lhs,
const RigidBodyIterator rhs 
)
friend

Equality comparison between two PtrIterator objects.

Parameters
lhsThe left-hand side pointer iterator.
rhsThe right-hand side pointer iterator.
Returns
true if the iterators point to the same element, false if not.

◆ operator>

bool operator> ( const RigidBodyIterator lhs,
const RigidBodyIterator rhs 
)
friend

Greater-than comparison between two PtrIterator objects.

Parameters
lhsThe left-hand side pointer iterator.
rhsThe right-hand side pointer iterator.
Returns
true if the left-hand side iterator points to a higher element, false if not.

◆ operator>=

bool operator>= ( const RigidBodyIterator lhs,
const RigidBodyIterator rhs 
)
friend

Greater-or-equal-than comparison between two PtrIterator objects.

Parameters
lhsThe left-hand side pointer iterator.
rhsThe right-hand side pointer iterator.
Returns
true if the left-hand side iterator points to a higher or the same element, false if not.

Member Data Documentation

◆ it_

ContainerType::iterator walberla::pe::RigidBodyIterator::it_
private

wrapped iterator


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