CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::RandomAccessEnumIteratorBase< ValueType, IsConst > Class Template Reference

#include <RandomAccessEnumerator.hh>

+ Inheritance diagram for CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >:

Detailed Description

template<typename ValueType, bool IsConst = true>
class CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >

RandomAccessEnumIterator implemenation.

  • Holds a member variable 'm_it_step' indicating current 'step' value.
  • If 'step' == enumerator 'size', then the iterator has reached 'end'
  • To dereference an object, ensures that the enumerator being pointed at is at step 'm_it_step' by calling 'goto_step'. Then the enumerator's 'current' object reference can be safely returned.
  • Inherits from InputEnumIteratorBase so that it can be held by InputEnumIterator

Definition at line 31 of file RandomAccessEnumerator.hh.

Public Types

typedef step_type difference_type
 
typedef ValueType value_type
 
typedef ValEnumerator
< ValueType, IsConst >
::reference 
reference
 
typedef EnumeratorBase::step_type step_type
 

Public Member Functions

 RandomAccessEnumIteratorBase ()
 
 RandomAccessEnumIteratorBase (RandomAccessEnumeratorBase< ValueType, IsConst > &enumerator, bool is_end)
 
step_type step () const override
 
bool is_end () const override
 
std::unique_ptr
< RandomAccessEnumIteratorBase
clone () const
 
jsonParser source () const
 
std::string name () const
 Uses enumerator class 'name' implementation. More...
 

Protected Member Functions

bool _constructed_as_end () const
 
void _assert_same_ptr (const EnumIteratorBase &other) const
 
void _assert_ptr () const
 
void _assert_valid () const
 
bool equal (const EnumIteratorBase &other) const
 boost::iterator_facade implementation More...
 
EnumeratorBase_enum_ptr ()
 
EnumeratorBase_enum_ptr () const
 

Private Member Functions

reference dereference () const override
 boost::iterator_facade implementation More...
 
void increment () override
 boost::iterator_facade implementation More...
 
void decrement ()
 boost::iterator_facade implementation More...
 
void advance (step_type n)
 boost::iterator_facade implementation More...
 
difference_type distance_to (const RandomAccessEnumIteratorBase &B) const
 boost::iterator_facade implementation More...
 
RandomAccessEnumIteratorBase
< ValueType, IsConst > * 
_clone () const override
 clone implementation More...
 
RandomAccessEnumeratorBase
< ValueType, IsConst > & 
_enum ()
 static_cast enumerator pointer to RandomAccessEnumeratorBase& More...
 
RandomAccessEnumeratorBase
< ValueType, IsConst > & 
_enum () const
 static_cast enumerator pointer to RandomAccessEnumeratorBase& More...
 

Private Attributes

friend RandomAccessEnumIterator< ValueType, IsConst >
 
step_type m_it_step
 

Member Typedef Documentation

template<typename ValueType, bool IsConst = true>
typedef step_type CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::difference_type

Definition at line 40 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
typedef ValEnumerator<ValueType, IsConst>::reference CASM::ValEnumIterator< ValueType, IsConst >::reference
inherited

Definition at line 362 of file Enumerator.hh.

template<typename ValueType, bool IsConst = true>
typedef EnumeratorBase::step_type CASM::EnumIteratorBase::step_type
inherited

Definition at line 259 of file Enumerator.hh.

template<typename ValueType, bool IsConst = true>
typedef ValueType CASM::ValEnumIterator< ValueType, IsConst >::value_type
inherited

Definition at line 361 of file Enumerator.hh.

Constructor & Destructor Documentation

template<typename ValueType, bool IsConst = true>
CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::RandomAccessEnumIteratorBase ( )
inline

Definition at line 43 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::RandomAccessEnumIteratorBase ( RandomAccessEnumeratorBase< ValueType, IsConst > &  enumerator,
bool  is_end 
)
inline

Definition at line 45 of file RandomAccessEnumerator.hh.

Member Function Documentation

void CASM::EnumIteratorBase::_assert_ptr ( ) const
inlineprotectedinherited

Definition at line 303 of file Enumerator.hh.

void CASM::EnumIteratorBase::_assert_same_ptr ( const EnumIteratorBase other) const
inlineprotectedinherited

Definition at line 298 of file Enumerator.hh.

void CASM::EnumIteratorBase::_assert_valid ( ) const
inlineprotectedinherited

Definition at line 307 of file Enumerator.hh.

template<typename ValueType, bool IsConst = true>
RandomAccessEnumIteratorBase<ValueType, IsConst>* CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::_clone ( ) const
inlineoverrideprivatevirtual

clone implementation

Reimplemented from CASM::InputEnumIteratorBase< ValueType, IsConst >.

Definition at line 115 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
bool CASM::InputEnumIteratorBase< ValueType, IsConst >::_constructed_as_end ( ) const
inlineprotectedinherited

Definition at line 68 of file InputEnumerator.hh.

template<typename ValueType, bool IsConst = true>
RandomAccessEnumeratorBase<ValueType, IsConst>& CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::_enum ( )
inlineprivate

static_cast enumerator pointer to RandomAccessEnumeratorBase&

Definition at line 120 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
RandomAccessEnumeratorBase<ValueType, IsConst>& CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::_enum ( ) const
inlineprivate

static_cast enumerator pointer to RandomAccessEnumeratorBase&

Definition at line 125 of file RandomAccessEnumerator.hh.

EnumeratorBase* CASM::EnumIteratorBase::_enum_ptr ( )
inlineprotectedinherited

Definition at line 330 of file Enumerator.hh.

EnumeratorBase* CASM::EnumIteratorBase::_enum_ptr ( ) const
inlineprotectedinherited

Definition at line 334 of file Enumerator.hh.

template<typename ValueType, bool IsConst = true>
void CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::advance ( step_type  n)
inlineprivate

boost::iterator_facade implementation

Definition at line 105 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
std::unique_ptr<RandomAccessEnumIteratorBase> CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::clone ( ) const
inline

Definition at line 77 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
void CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::decrement ( )
inlineprivate

boost::iterator_facade implementation

Definition at line 100 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
reference CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::dereference ( ) const
inlineoverrideprivatevirtual

boost::iterator_facade implementation

Reimplemented from CASM::InputEnumIteratorBase< ValueType, IsConst >.

Definition at line 89 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
difference_type CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::distance_to ( const RandomAccessEnumIteratorBase< ValueType, IsConst > &  B) const
inlineprivate

boost::iterator_facade implementation

Definition at line 110 of file RandomAccessEnumerator.hh.

bool CASM::EnumIteratorBase::equal ( const EnumIteratorBase other) const
inlineprotectedinherited

boost::iterator_facade implementation

  • Uses 'is_end' implementation to check if both iterators are 'end'
  • If both are not end, then compares iterator 'step'

Definition at line 315 of file Enumerator.hh.

template<typename ValueType, bool IsConst = true>
void CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::increment ( )
inlineoverrideprivatevirtual

boost::iterator_facade implementation

Reimplemented from CASM::InputEnumIteratorBase< ValueType, IsConst >.

Definition at line 95 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
bool CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::is_end ( ) const
inlineoverridevirtual

Check if end iterator

Returns true if:

  • Iterator was constructed as end iterator
  • Or, iterator step value equals enumerator size

Reimplemented from CASM::InputEnumIteratorBase< ValueType, IsConst >.

Definition at line 72 of file RandomAccessEnumerator.hh.

std::string CASM::EnumIteratorBase::name ( ) const
inlineinherited

Uses enumerator class 'name' implementation.

Definition at line 284 of file Enumerator.hh.

jsonParser CASM::EnumIteratorBase::source ( ) const
inlineinherited

Uses 'step' and enumerator class 'source' implementation

  • Only valid if iterator refers to valid object (not end)

Definition at line 279 of file Enumerator.hh.

template<typename ValueType, bool IsConst = true>
step_type CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::step ( ) const
inlineoverridevirtual

Return current step number

  • Only valid if iterator refers to valid object (not end)

Reimplemented from CASM::InputEnumIteratorBase< ValueType, IsConst >.

Definition at line 63 of file RandomAccessEnumerator.hh.

Member Data Documentation

template<typename ValueType, bool IsConst = true>
step_type CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::m_it_step
private

Definition at line 129 of file RandomAccessEnumerator.hh.

template<typename ValueType, bool IsConst = true>
friend CASM::RandomAccessEnumIteratorBase< ValueType, IsConst >::RandomAccessEnumIterator< ValueType, IsConst >
private

Definition at line 33 of file RandomAccessEnumerator.hh.


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