walberla::pe::RigidBodyCastIterator< C > Class Template Reference

Detailed Description

template<typename C>
class walberla::pe::RigidBodyCastIterator< C >

Dynamic cast iterator for polymorphic pointer vectors.

The RigidBodyCastIterator is a forward iterator which only selects elements of type C. Dereferencing this iterator will implicitly cast to C.

#include <RigidBodyCastIterator.h>

Public Types

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

Public Member Functions

Constructors
 RigidBodyCastIterator ()=default
 
 RigidBodyCastIterator (const typename ContainerType::iterator &begin, const typename ContainerType::iterator &end)
 Standard constructor for CastIterator. More...
 
 RigidBodyCastIterator (const RigidBodyCastIterator< C > &it)=default
 
 RigidBodyCastIterator (RigidBodyCastIterator< C > &&it)=default
 
RigidBodyCastIteratoroperator= (const RigidBodyCastIterator< C > &it)=default
 
RigidBodyCastIteratoroperator= (RigidBodyCastIterator< C > &&it)=default
 
Operators
RigidBodyCastIterator< C > & operator++ ()
 Pre-increment operator. More...
 
RigidBodyCastIterator< C > operator++ (int)
 
Access operators
reference operator* ()
 
pointer operator-> ()
 
Utility functions
pointer getBodyID ()
 

Private Attributes

Member variables
ContainerType::iterator cur_
 Pointer to the current memory location. More...
 
ContainerType::iterator end_
 Pointer to the element one past the last element in the element range. More...
 

Friends

template<typename C2 >
bool operator== (const RigidBodyCastIterator< C2 > &lhs, const RigidBodyCastIterator< C2 > &rhs)
 
template<typename C2 >
bool operator!= (const RigidBodyCastIterator< C2 > &lhs, const RigidBodyCastIterator< C2 > &rhs)
 

Member Typedef Documentation

◆ ContainerType

template<typename C >
using walberla::pe::RigidBodyCastIterator< C >::ContainerType = std::vector< std::unique_ptr<RigidBody> >

◆ difference_type

template<typename C >
using walberla::pe::RigidBodyCastIterator< C >::difference_type = std::ptrdiff_t

◆ iterator_category

template<typename C >
using walberla::pe::RigidBodyCastIterator< C >::iterator_category = std::forward_iterator_tag

◆ pointer

template<typename C >
using walberla::pe::RigidBodyCastIterator< C >::pointer = C*

◆ reference

template<typename C >
using walberla::pe::RigidBodyCastIterator< C >::reference = C&

◆ value_type

template<typename C >
using walberla::pe::RigidBodyCastIterator< C >::value_type = C

Constructor & Destructor Documentation

◆ RigidBodyCastIterator() [1/4]

template<typename C >
walberla::pe::RigidBodyCastIterator< C >::RigidBodyCastIterator ( )
inlinedefault

◆ RigidBodyCastIterator() [2/4]

template<typename C >
walberla::pe::RigidBodyCastIterator< C >::RigidBodyCastIterator ( const typename ContainerType::iterator &  begin,
const typename ContainerType::iterator &  end 
)
inlineexplicit

Standard constructor for CastIterator.

Parameters
beginThe beginning of the element range.
endThe end of the element range.

◆ RigidBodyCastIterator() [3/4]

template<typename C >
walberla::pe::RigidBodyCastIterator< C >::RigidBodyCastIterator ( const RigidBodyCastIterator< C > &  it)
default

◆ RigidBodyCastIterator() [4/4]

template<typename C >
walberla::pe::RigidBodyCastIterator< C >::RigidBodyCastIterator ( RigidBodyCastIterator< C > &&  it)
default

Member Function Documentation

◆ getBodyID()

template<typename C >
pointer walberla::pe::RigidBodyCastIterator< C >::getBodyID ( )
inline

◆ operator*()

template<typename C >
reference walberla::pe::RigidBodyCastIterator< C >::operator* ( )
inline

◆ operator++() [1/2]

template<typename C >
RigidBodyCastIterator< C > & walberla::pe::RigidBodyCastIterator< C >::operator++
inline

Pre-increment operator.

Returns
Reference to the incremented cast iterator.

◆ operator++() [2/2]

template<typename C >
RigidBodyCastIterator<C> walberla::pe::RigidBodyCastIterator< C >::operator++ ( int  )
inline

◆ operator->()

template<typename C >
pointer walberla::pe::RigidBodyCastIterator< C >::operator-> ( )
inline

◆ operator=() [1/2]

template<typename C >
RigidBodyCastIterator& walberla::pe::RigidBodyCastIterator< C >::operator= ( const RigidBodyCastIterator< C > &  it)
default

◆ operator=() [2/2]

template<typename C >
RigidBodyCastIterator& walberla::pe::RigidBodyCastIterator< C >::operator= ( RigidBodyCastIterator< C > &&  it)
default

Friends And Related Function Documentation

◆ operator!=

template<typename C >
template<typename C2 >
bool operator!= ( const RigidBodyCastIterator< C2 > &  lhs,
const RigidBodyCastIterator< C2 > &  rhs 
)
friend

◆ operator==

template<typename C >
template<typename C2 >
bool operator== ( const RigidBodyCastIterator< C2 > &  lhs,
const RigidBodyCastIterator< C2 > &  rhs 
)
friend

Member Data Documentation

◆ cur_

template<typename C >
ContainerType::iterator walberla::pe::RigidBodyCastIterator< C >::cur_
private

Pointer to the current memory location.

◆ end_

template<typename C >
ContainerType::iterator walberla::pe::RigidBodyCastIterator< C >::end_
private

Pointer to the element one past the last element in the element range.


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