1 #ifndef CASM_Enumerator
2 #define CASM_Enumerator
131 src[
"enumerated_by"] = this->
name();
137 virtual std::string
name()
const = 0;
170 template <
typename ValueType,
bool IsConst = true>
251 std::unique_ptr<EnumIteratorBase>
clone()
const {
252 return std::unique_ptr<EnumIteratorBase>(this->
_clone());
258 "Comparing EnumIterator referring to different enumerators is not "
263 assert(
m_enum_ptr &&
"EnumIterator does not point to any enumerator!");
268 "EnumIterator points to an invalid enumerator!");
276 bool this_is_end = this->
is_end();
277 bool other_is_end = other.
is_end();
279 if (this_is_end != other_is_end) {
287 return (this->
step() == other.
step());
305 template <
typename ValueType,
bool IsConst = true>
324 std::unique_ptr<EnumIteratorBase>
clone()
const {
325 return std::unique_ptr<EnumIteratorBase>(this->
_clone());
342 template <
typename EnumeratorType>
EnumeratorBase * _enum_ptr() const
EnumeratorBase * m_enum_ptr
void _assert_same_ptr(const EnumIteratorBase &other) const
EnumeratorBase * _enum_ptr()
virtual ~EnumIteratorBase()
EnumIteratorBase()
Default Constructor.
void _assert_valid() const
EnumeratorBase::step_type step_type
virtual bool is_end() const =0
Returns true if 'end' iterator.
std::string name() const
Uses enumerator class 'name' implementation.
EnumIteratorBase(EnumeratorBase &enumerator)
Constructor.
jsonParser source() const
std::unique_ptr< EnumIteratorBase > clone() const
EnumeratorBase & _enum() const
bool equal(const EnumIteratorBase &other) const
boost::iterator_facade implementation
virtual step_type step() const =0
virtual EnumIteratorBase * _clone() const =0
Abstract base class for enumerators.
bool valid() const
Returns false if enumeration is complete.
virtual std::string name() const =0
Derived enumerators must implement name, via ENUM_MEMBERS.
virtual jsonParser source(step_type step) const
EnumeratorBase()
Default constructor.
void _validate()
Used if random access enumerator step is moved into valid range.
void _invalidate()
Call if enumeration complete.
void _increment_step()
Increment current step value.
step_type step() const
Increments with each enumerated object.
void _set_step(step_type val)
Set current step value.
virtual ~EnumeratorBase()
void _decrement_step()
Decrement current step value.
virtual EnumIteratorBase * _clone() const =0
virtual ~ValEnumIterator()
ValEnumerator< ValueType, IsConst >::reference reference
std::unique_ptr< EnumIteratorBase > clone() const
virtual reference dereference() const =0
ValEnumIterator(ValEnumerator< ValueType, IsConst > &enumerator)
void _set_current_ptr(CASM_TMP::ConstSwitch< IsConst, value_type > *_new)
Change the pointer.
CASM_TMP::ConstSwitch< IsConst, value_type > * m_current_ptr
reference current() const
Access the current ObjectType by reference.
void _initialize(CASM_TMP::ConstSwitch< IsConst, value_type > *_initial)
CASM_TMP::ConstSwitch< IsConst, ValueType > & reference
bool is_guaranteed_for_database_insert(ConfigEnumAllOccupations const &enumerator)
typename std::conditional< IsConst, const T, T >::type ConstSwitch