CASM  1.1.0
A Clusters Approach to Statistical Mechanics
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< RandomAccessEnumIteratorBaseclone () const
 
virtual step_type step () const=0
 
virtual bool is_end () const=0
 Returns true if 'end' iterator. More...
 
std::string name () const
 Uses enumerator class 'name' implementation. More...
 
std::string name () const
 Uses enumerator class 'name' implementation. More...
 
jsonParser source () const
 
jsonParser source () const
 

Protected Member Functions

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

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
 
friend InputEnumIterator< ValueType, IsConst >
 
bool m_constructed_as_end
 
EnumeratorBasem_enum_ptr
 

Member Typedef Documentation

◆ difference_type

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

Definition at line 39 of file RandomAccessEnumerator.hh.

◆ reference

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

Definition at line 310 of file Enumerator.hh.

◆ step_type

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

Definition at line 225 of file Enumerator.hh.

◆ value_type

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

Definition at line 309 of file Enumerator.hh.

Constructor & Destructor Documentation

◆ RandomAccessEnumIteratorBase() [1/2]

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

Definition at line 41 of file RandomAccessEnumerator.hh.

◆ RandomAccessEnumIteratorBase() [2/2]

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

Definition at line 43 of file RandomAccessEnumerator.hh.

Member Function Documentation

◆ _assert_ptr() [1/2]

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

Definition at line 262 of file Enumerator.hh.

◆ _assert_ptr() [2/2]

template<typename ValueType , bool IsConst = true>
void CASM::EnumIteratorBase::_assert_ptr
inlineprotectedinherited

Definition at line 262 of file Enumerator.hh.

◆ _assert_same_ptr() [1/2]

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

Definition at line 256 of file Enumerator.hh.

◆ _assert_same_ptr() [2/2]

template<typename ValueType , bool IsConst = true>
void CASM::EnumIteratorBase::_assert_same_ptr
inlineprotectedinherited

Definition at line 256 of file Enumerator.hh.

◆ _assert_valid() [1/2]

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

Definition at line 266 of file Enumerator.hh.

◆ _assert_valid() [2/2]

template<typename ValueType , bool IsConst = true>
void CASM::EnumIteratorBase::_assert_valid
inlineprotectedinherited

Definition at line 266 of file Enumerator.hh.

◆ _clone()

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

clone implementation

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

Definition at line 101 of file RandomAccessEnumerator.hh.

◆ _constructed_as_end()

bool CASM::InputEnumIteratorBase< ValueType, IsConst >::_constructed_as_end ( ) const
inlineprotectedinherited

Definition at line 63 of file InputEnumerator.hh.

◆ _enum() [1/2]

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

static_cast enumerator pointer to RandomAccessEnumeratorBase&

Definition at line 106 of file RandomAccessEnumerator.hh.

◆ _enum() [2/2]

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 112 of file RandomAccessEnumerator.hh.

◆ _enum_ptr() [1/3]

template<typename ValueType , bool IsConst = true>
EnumeratorBase* CASM::EnumIteratorBase::_enum_ptr
inlineprotectedinherited

Definition at line 290 of file Enumerator.hh.

◆ _enum_ptr() [2/3]

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

Definition at line 292 of file Enumerator.hh.

◆ _enum_ptr() [3/3]

template<typename ValueType , bool IsConst = true>
EnumeratorBase* CASM::EnumIteratorBase::_enum_ptr
inlineprotectedinherited

Definition at line 292 of file Enumerator.hh.

◆ advance()

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

boost::iterator_facade implementation

Definition at line 93 of file RandomAccessEnumerator.hh.

◆ clone()

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

Definition at line 71 of file RandomAccessEnumerator.hh.

◆ decrement()

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

boost::iterator_facade implementation

Definition at line 90 of file RandomAccessEnumerator.hh.

◆ dereference()

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

boost::iterator_facade implementation

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

Definition at line 81 of file RandomAccessEnumerator.hh.

◆ distance_to()

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 96 of file RandomAccessEnumerator.hh.

◆ equal() [1/2]

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 275 of file Enumerator.hh.

◆ equal() [2/2]

template<typename ValueType , bool IsConst = true>
bool CASM::EnumIteratorBase::equal
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 275 of file Enumerator.hh.

◆ increment()

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

boost::iterator_facade implementation

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

Definition at line 87 of file RandomAccessEnumerator.hh.

◆ is_end() [1/2]

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, true >.

Definition at line 66 of file RandomAccessEnumerator.hh.

◆ is_end() [2/2]

template<typename ValueType , bool IsConst = true>
virtual bool CASM::EnumIteratorBase::is_end
inherited

Returns true if 'end' iterator.

◆ name() [1/2]

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

Uses enumerator class 'name' implementation.

Definition at line 246 of file Enumerator.hh.

◆ name() [2/2]

std::string CASM::EnumIteratorBase::name
inlineinherited

Uses enumerator class 'name' implementation.

Definition at line 32 of file Enumerator.hh.

◆ source() [1/2]

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 243 of file Enumerator.hh.

◆ source() [2/2]

jsonParser CASM::EnumIteratorBase::source
inlineinherited

Uses 'step' and enumerator class 'source' implementation

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

Definition at line 33 of file Enumerator.hh.

◆ step() [1/2]

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, true >.

Definition at line 59 of file RandomAccessEnumerator.hh.

◆ step() [2/2]

template<typename ValueType , bool IsConst = true>
virtual step_type CASM::EnumIteratorBase::step
inherited

Return current step number

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

Member Data Documentation

◆ InputEnumIterator< ValueType, IsConst >

friend CASM::InputEnumIteratorBase< ValueType, IsConst >::InputEnumIterator< ValueType, IsConst >
privateinherited

Definition at line 18 of file InputEnumerator.hh.

◆ m_constructed_as_end

bool CASM::InputEnumIteratorBase< ValueType, IsConst >::m_constructed_as_end
privateinherited

Definition at line 86 of file InputEnumerator.hh.

◆ m_enum_ptr

EnumeratorBase* CASM::EnumIteratorBase::m_enum_ptr
privateinherited

Definition at line 302 of file Enumerator.hh.

◆ m_it_step

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

Definition at line 117 of file RandomAccessEnumerator.hh.

◆ RandomAccessEnumIterator< ValueType, IsConst >

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: