CASM  1.1.0
A Clusters Approach to Statistical Mechanics
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 105 of file Enumerator.hh.

Public Types

typedef long step_type
 

Public Member Functions

 EnumeratorBase ()
 Default constructor. More...
 
virtual ~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

◆ step_type

Definition at line 107 of file Enumerator.hh.

Constructor & Destructor Documentation

◆ EnumeratorBase()

CASM::EnumeratorBase::EnumeratorBase ( )
inline

Default constructor.

Definition at line 110 of file Enumerator.hh.

◆ ~EnumeratorBase()

virtual CASM::EnumeratorBase::~EnumeratorBase ( )
inlinevirtual

Definition at line 112 of file Enumerator.hh.

Member Function Documentation

◆ _decrement_step()

void CASM::EnumeratorBase::_decrement_step ( )
inlineprotected

Decrement current step value.

Definition at line 156 of file Enumerator.hh.

◆ _increment_step()

void CASM::EnumeratorBase::_increment_step ( )
inlineprotected

Increment current step value.

Definition at line 153 of file Enumerator.hh.

◆ _initialize()

void CASM::EnumeratorBase::_initialize ( )
inlineprotected

Initialize

  • Sets step to 0
  • Sets valid to true

Definition at line 144 of file Enumerator.hh.

◆ _invalidate()

void CASM::EnumeratorBase::_invalidate ( )
inlineprotected

Call if enumeration complete.

Definition at line 159 of file Enumerator.hh.

◆ _set_step()

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

Set current step value.

Definition at line 150 of file Enumerator.hh.

◆ _validate()

void CASM::EnumeratorBase::_validate ( )
inlineprotected

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

Definition at line 162 of file Enumerator.hh.

◆ name()

◆ source()

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

Default Object source just uses step#

Returns:

{
"enumerated_by": "<enumerator_type>",
"step": <step #>
}
step_type step() const
Increments with each enumerated object.
Definition: Enumerator.hh:115

Definition at line 129 of file Enumerator.hh.

◆ step()

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

Increments with each enumerated object.

Definition at line 115 of file Enumerator.hh.

◆ valid()

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

Returns false if enumeration is complete.

Definition at line 118 of file Enumerator.hh.

Member Data Documentation

◆ m_step

step_type CASM::EnumeratorBase::m_step
private

Definition at line 167 of file Enumerator.hh.

◆ m_valid

bool CASM::EnumeratorBase::m_valid
private

Definition at line 165 of file Enumerator.hh.


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