CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::EnumeratorBase Class Referenceabstract

#include <Enumerator.hh>

+ Inheritance diagram for CASM::EnumeratorBase:

Detailed Description

Abstract base class for enumerators.

  • To implement a new enumeration method do not inherit from this directly. Instead, inherit from either InputEnum (for single-pass enumerators) or RandomAccessEnum (for multi-pass, random-access enumerators)
  • The Enumerator base class only holds a pointer to the 'current' object, the current 'step' index, and a 'valid' flag

Definition at line 99 of file Enumerator.hh.

Public Types

typedef long step_type
 

Public Member Functions

 EnumeratorBase ()
 Default constructor. More...
 
 ~EnumeratorBase ()
 
step_type step () const
 Increments with each enumerated object. More...
 
bool valid () const
 Returns false if enumeration is complete. More...
 
virtual jsonParser source (step_type step) const
 
virtual std::string name () const =0
 Derived enumerators must implement name, via ENUM_MEMBERS. More...
 

Protected Member Functions

void _initialize ()
 
void _set_step (step_type val)
 Set current step value. More...
 
void _increment_step ()
 Increment current step value. More...
 
void _decrement_step ()
 Decrement current step value. More...
 
void _invalidate ()
 Call if enumeration complete. More...
 
void _validate ()
 Used if random access enumerator step is moved into valid range. More...
 

Private Attributes

bool m_valid
 
step_type m_step
 

Member Typedef Documentation

Definition at line 103 of file Enumerator.hh.

Constructor & Destructor Documentation

CASM::EnumeratorBase::EnumeratorBase ( )
inline

Default constructor.

Definition at line 106 of file Enumerator.hh.

CASM::EnumeratorBase::~EnumeratorBase ( )
inline

Definition at line 110 of file Enumerator.hh.

Member Function Documentation

void CASM::EnumeratorBase::_decrement_step ( )
inlineprotected

Decrement current step value.

Definition at line 164 of file Enumerator.hh.

void CASM::EnumeratorBase::_increment_step ( )
inlineprotected

Increment current step value.

Definition at line 159 of file Enumerator.hh.

void CASM::EnumeratorBase::_initialize ( )
inlineprotected

Initialize

  • Sets step to 0
  • Sets valid to true

Definition at line 148 of file Enumerator.hh.

void CASM::EnumeratorBase::_invalidate ( )
inlineprotected

Call if enumeration complete.

Definition at line 169 of file Enumerator.hh.

void CASM::EnumeratorBase::_set_step ( step_type  val)
inlineprotected

Set current step value.

Definition at line 154 of file Enumerator.hh.

void CASM::EnumeratorBase::_validate ( )
inlineprotected

Used if random access enumerator step is moved into valid range.

Definition at line 174 of file Enumerator.hh.

virtual jsonParser CASM::EnumeratorBase::source ( step_type  step) const
inlinevirtual

Default Object source just uses step#

Returns:

{
"enumerated_by": "<enumerator_type>",
"step": <step #>
}

Definition at line 131 of file Enumerator.hh.

step_type CASM::EnumeratorBase::step ( ) const
inline

Increments with each enumerated object.

Definition at line 113 of file Enumerator.hh.

bool CASM::EnumeratorBase::valid ( ) const
inline

Returns false if enumeration is complete.

Definition at line 118 of file Enumerator.hh.

Member Data Documentation

step_type CASM::EnumeratorBase::m_step
private

Definition at line 182 of file Enumerator.hh.

bool CASM::EnumeratorBase::m_valid
private

Definition at line 180 of file Enumerator.hh.


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