Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::EnumerationSequenceContainer< T > Class Template Reference

Container for sequences of enumeration values. More...

#include <Safir/Dob/Typesystem/SequenceContainer.h>

Inheritance diagram for Safir::Dob::Typesystem::EnumerationSequenceContainer< T >:
[legend]
Collaboration diagram for Safir::Dob::Typesystem::EnumerationSequenceContainer< T >:
[legend]

Public Types

typedef T::Enumeration ContainedType
 
typedef std::deque< ContainedTypeStorageType
 
typedef StorageType::const_iterator const_iterator
 

Public Member Functions

 EnumerationSequenceContainer ()
 Default Constructor.
 
size_t size () const override
 Get the size of the sequence, i.e number of contained values.
 
bool empty () const override
 Check if sequence is empty.
 
ContainedType front () const
 Get a const reference to the first value in the sequence.
 
ContainedType back () const
 Get a const reference to the last value in the sequence.
 
const_iterator begin () const
 Get const_iterator pointing to the first element in the sequence.
 
const_iterator end () const
 Get const_iterator pointing past the last element in the sequence.
 
void clear () override
 Clear the sequence, i.e remove all values.
 
ContainedType operator[] (const size_t index) const
 Get the value at the specified index.
 
ContainedType at (const size_t index) const
 Get the value at the specified index.
 
void push_back (const ContainedType val)
 Insert a new value last in the sequence.
 
void PushBackOrdinal (const EnumerationValue val) override
 Insert a new ordinal value last in the sequence.
 
void SetVal (const size_t index, const ContainedType val)
 Update a specific value.
 
ContainedType GetVal (const size_t index) const
 Get the value at the specified index.
 
void SetOrdinal (const size_t index, const EnumerationValue val) override
 Update a specific value, using ordinal value.
 
EnumerationValue GetOrdinal (const size_t index) const override
 Get the ordinal value of the value at the specified index.
 
void InsertAt (const size_t index, ContainedType value)
 Insert a new value at specified index.
 
void InsertOrdinalAt (const size_t index, EnumerationValue value) override
 Insert a new ordinal value at specified index, growing the sequence.
 
void EraseAt (const size_t index) override
 Erase a value at specified index.
 
void Copy (const ContainerBase &that) override
 Copy all the members from "that" into "this".
 
- Public Member Functions inherited from Safir::Dob::Typesystem::EnumerationSequenceContainerBase
 EnumerationSequenceContainerBase ()
 Default Constructor.
 
bool IsNull () const override
 Is the container set to null?
 
void SetNull () override
 Set the container to null.
 
- Public Member Functions inherited from Safir::Dob::Typesystem::ContainerBase
constexpr ContainerBase ()
 Default Constructor.
 
constexpr ContainerBase (const ContainerBase &)=default
 Copy constructor.
 
virtual ~ContainerBase ()
 Virtual destructor.
 
virtual bool IsChanged () const
 Is the change flag set on the container?
 
virtual void SetChanged (const bool changed)
 Set the containers change flag.
 

Additional Inherited Members

- Protected Member Functions inherited from Safir::Dob::Typesystem::ContainerBase
ContainerBaseoperator= (const ContainerBase &other)
 Copy assignment operator.
 
- Protected Attributes inherited from Safir::Dob::Typesystem::ContainerBase
bool m_bIsChanged
 The variable containing the change flag.
 

Detailed Description

template<class T>
class Safir::Dob::Typesystem::EnumerationSequenceContainer< T >

Container for sequences of enumeration values.

Member Typedef Documentation

◆ const_iterator

template<class T >
typedef StorageType::const_iterator Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::const_iterator

◆ ContainedType

template<class T >
typedef T::Enumeration Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::ContainedType

◆ StorageType

template<class T >
typedef std::deque<ContainedType> Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::StorageType

Constructor & Destructor Documentation

◆ EnumerationSequenceContainer()

template<class T >
Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::EnumerationSequenceContainer ( )

Default Constructor.

Construct a container that is not changed and not null.

Member Function Documentation

◆ at()

template<class T >
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::at ( const size_t index) const

Get the value at the specified index.

Parameters
index[in] - Index of the value to get.
Returns
Const reference to a value.
Exceptions
std::out_of_rangeexception if index is not in range

◆ back()

Get a const reference to the last value in the sequence.

Returns
Reference to last value.

◆ begin()

template<class T >
const_iterator Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::begin ( ) const

Get const_iterator pointing to the first element in the sequence.

Returns
Iterator pointing to the first element.

◆ clear()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::clear ( )
overridevirtual

Clear the sequence, i.e remove all values.

After a call to clear the sequence will be empty but not automatically set to null.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

◆ Copy()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::Copy ( const ContainerBase & that)
overridevirtual

Copy all the members from "that" into "this".

Note: Types must be the same for this to work!

Parameters
that[in] - The object to copy into this.
Exceptions
SoftwareViolationExceptionIf the types are not of the same kind.

Implements Safir::Dob::Typesystem::ContainerBase.

References __WFILE__, and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

◆ empty()

template<class T >
bool Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::empty ( ) const
overridevirtual

Check if sequence is empty.

Returns
True if sequence is empty, else false.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

◆ end()

Get const_iterator pointing past the last element in the sequence.

Returns
Iterator pointing to the end of the sequence.

◆ EraseAt()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::EraseAt ( const size_t index)
overridevirtual

Erase a value at specified index.

The sequence will shrink.

Parameters
index[in] - Index of the value to be removed.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

◆ front()

template<class T >
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::front ( ) const

Get a const reference to the first value in the sequence.

Returns
Reference to first value.

◆ GetOrdinal()

template<class T >
EnumerationValue Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::GetOrdinal ( const size_t index) const
overridevirtual

Get the ordinal value of the value at the specified index.

Parameters
index[in] - Index of the value to get.
Returns
Ordinal value a the index.
Exceptions
std::out_of_rangeexception if index is not in range

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

◆ GetVal()

template<class T >
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::GetVal ( const size_t index) const

Get the value at the specified index.

Parameters
index[in] - Index of the value to get.
Returns
Const reference to a value.
Exceptions
std::out_of_rangeexception if index is not in range

◆ InsertAt()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::InsertAt ( const size_t index,
ContainedType value )

Insert a new value at specified index.

The sequence size will grow.

Parameters
index[in] - Index of the new value.
value[in] - Value to insert.

References Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::InsertOrdinalAt().

Here is the call graph for this function:

◆ InsertOrdinalAt()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::InsertOrdinalAt ( const size_t index,
EnumerationValue value )
overridevirtual

Insert a new ordinal value at specified index, growing the sequence.

Parameters
index[in] - Index of the new value.
value[in] - Value to insert.
Exceptions
IllegalValueExceptionif the value is not in the enumeration.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

References __WFILE__, and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

Referenced by Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::InsertAt().

Here is the caller graph for this function:

◆ operator[]()

template<class T >
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::operator[] ( const size_t index) const

Get the value at the specified index.

Note that no checks are made to see whether index is inside range.

Parameters
index[in] - Index of the value to get.
Returns
The value at the index.

◆ push_back()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::push_back ( const ContainedType val)

Insert a new value last in the sequence.

If the sequence was null before it will no longer be null after a call to push_back.

Parameters
val[in] - Value to be inserted.

References Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::PushBackOrdinal().

Here is the call graph for this function:

◆ PushBackOrdinal()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::PushBackOrdinal ( const EnumerationValue val)
overridevirtual

Insert a new ordinal value last in the sequence.

If the sequence was null before it will no longer be null after this call.

Parameters
val[in] - Value to be inserted.
Exceptions
IllegalValueExceptionif the value is not in the enumeration.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

References __WFILE__, and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

Referenced by Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::push_back().

Here is the caller graph for this function:

◆ SetOrdinal()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::SetOrdinal ( const size_t index,
const EnumerationValue val )
overridevirtual

Update a specific value, using ordinal value.

Will not add new values to the sequence.

Parameters
index[in] - Index of the value to set.
val[in] - Value to set.
Exceptions
std::out_of_rangeexception if index is not in range
IllegalValueExceptionif the value is not in the enumeration.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.

References __WFILE__, and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

Referenced by Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::SetVal().

Here is the caller graph for this function:

◆ SetVal()

template<class T >
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::SetVal ( const size_t index,
const ContainedType val )

Update a specific value.

Will not add new values.

Parameters
index[in] - Index of the value to set.
val[in] - Value to set.
Exceptions
std::out_of_rangeexception if index is not in range

References Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::SetOrdinal().

Here is the call graph for this function:

◆ size()

template<class T >
size_t Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::size ( ) const
overridevirtual

Get the size of the sequence, i.e number of contained values.

Returns
The number of values in the sequence.

Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.