Cogs.Core
Public Types | Public Member Functions | List of all members
Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator Struct Reference

Custom iterator providing iteration support for component pools. More...

#include <ComponentPool.h>

Public Types

typedef std::forward_iterator_tag iterator_category
 Type of iterator. Can only be used to iterate forward over components in a pool.
 
typedef ComponentType value_type
 Value type for dereferencing the iterator is the templated ComponentType.
 
typedef size_t difference_type
 Difference type to calculate iterator distance.
 
typedef ComponentType * pointer
 Pointer type to the templated ComponentType.
 
typedef ComponentType & reference
 Reference type to the templated ComponentType.
 

Public Member Functions

 ComponentIterator (ComponentPool &pool, SizeType index)
 Construct a new component iterator on the given pool, starting at the given roster index.
 
 ComponentIterator (const ComponentIterator &other)
 Copy construct a new iterator instance from the given iterator.
 
constexpr bool operator== (const ComponentIterator &other) const
 Comparison operator. If the current index of both iterators are equal the iterators are considered equal.
 
ComponentIterator operator++ ()
 Post increment operator. Moves the iterator to the next component indexed in the roster of the pool.
 
ComponentIteratoroperator++ (int)
 Pre increment operator. Moves the iterator to the next component indexed in the roster of the pool.
 
ComponentType & operator* ()
 Dereference operator. Returns a reference to the component at the iterators current roster index.
 
const ComponentType & operator* () const
 Const dereference operator. Returns a const reference to the component at the current roster index.
 
const ComponentType * operator-> () const
 Pointer operator. Returns a pointer to the component at the current roster index.
 

Detailed Description

template<typename ComponentType>
struct Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator

Custom iterator providing iteration support for component pools.

Definition at line 130 of file ComponentPool.h.

Member Typedef Documentation

◆ difference_type

template<typename ComponentType >
typedef size_t Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::difference_type

Difference type to calculate iterator distance.

Definition at line 140 of file ComponentPool.h.

◆ iterator_category

template<typename ComponentType >
typedef std::forward_iterator_tag Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::iterator_category

Type of iterator. Can only be used to iterate forward over components in a pool.

Definition at line 134 of file ComponentPool.h.

◆ pointer

template<typename ComponentType >
typedef ComponentType* Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::pointer

Pointer type to the templated ComponentType.

Definition at line 143 of file ComponentPool.h.

◆ reference

template<typename ComponentType >
typedef ComponentType& Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::reference

Reference type to the templated ComponentType.

Definition at line 146 of file ComponentPool.h.

◆ value_type

template<typename ComponentType >
typedef ComponentType Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::value_type

Value type for dereferencing the iterator is the templated ComponentType.

Definition at line 137 of file ComponentPool.h.

Constructor & Destructor Documentation

◆ ComponentIterator() [1/2]

template<typename ComponentType >
Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::ComponentIterator ( ComponentPool pool,
SizeType  index 
)
inline

Construct a new component iterator on the given pool, starting at the given roster index.

Definition at line 149 of file ComponentPool.h.

◆ ComponentIterator() [2/2]

template<typename ComponentType >
Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::ComponentIterator ( const ComponentIterator other)
inline

Copy construct a new iterator instance from the given iterator.

Definition at line 152 of file ComponentPool.h.

Member Function Documentation

◆ operator*() [1/2]

template<typename ComponentType >
ComponentType & Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::operator* ( )
inline

Dereference operator. Returns a reference to the component at the iterators current roster index.

Definition at line 164 of file ComponentPool.h.

◆ operator*() [2/2]

template<typename ComponentType >
const ComponentType & Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::operator* ( ) const
inline

Const dereference operator. Returns a const reference to the component at the current roster index.

Definition at line 167 of file ComponentPool.h.

◆ operator++() [1/2]

template<typename ComponentType >
ComponentIterator Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::operator++ ( )
inline

Post increment operator. Moves the iterator to the next component indexed in the roster of the pool.

Definition at line 158 of file ComponentPool.h.

◆ operator++() [2/2]

template<typename ComponentType >
ComponentIterator & Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::operator++ ( int  )
inline

Pre increment operator. Moves the iterator to the next component indexed in the roster of the pool.

Definition at line 161 of file ComponentPool.h.

◆ operator->()

template<typename ComponentType >
const ComponentType * Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::operator-> ( ) const
inline

Pointer operator. Returns a pointer to the component at the current roster index.

Definition at line 170 of file ComponentPool.h.

◆ operator==()

template<typename ComponentType >
constexpr bool Cogs::ComponentModel::ComponentPool< ComponentType >::ComponentIterator::operator== ( const ComponentIterator other) const
inlineconstexpr

Comparison operator. If the current index of both iterators are equal the iterators are considered equal.

Definition at line 155 of file ComponentPool.h.


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