![]() |
Safir SDK Core
|
Container for sequences of enumeration values. More...
#include <Safir/Dob/Typesystem/SequenceContainer.h>
Public Types | |
typedef T::Enumeration | ContainedType |
typedef std::deque< ContainedType > | StorageType |
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". | |
![]() | |
EnumerationSequenceContainerBase () | |
Default Constructor. | |
bool | IsNull () const override |
Is the container set to null? | |
void | SetNull () override |
Set the container to null. | |
![]() | |
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 | |
![]() | |
ContainerBase & | operator= (const ContainerBase &other) |
Copy assignment operator. | |
![]() | |
bool | m_bIsChanged |
The variable containing the change flag. | |
Container for sequences of enumeration values.
typedef StorageType::const_iterator Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::const_iterator |
typedef T::Enumeration Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::ContainedType |
typedef std::deque<ContainedType> Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::StorageType |
Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::EnumerationSequenceContainer | ( | ) |
Default Constructor.
Construct a container that is not changed and not null.
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::at | ( | const size_t | index | ) | const |
Get the value at the specified index.
index | [in] - Index of the value to get. |
std::out_of_range | exception if index is not in range |
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::back | ( | ) | const |
Get a const reference to the last value in the sequence.
const_iterator Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::begin | ( | ) | const |
Get const_iterator pointing to the first element in the sequence.
|
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.
|
overridevirtual |
Copy all the members from "that" into "this".
Note: Types must be the same for this to work!
that | [in] - The object to copy into this. |
SoftwareViolationException | If the types are not of the same kind. |
Implements Safir::Dob::Typesystem::ContainerBase.
References __WFILE__, and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Check if sequence is empty.
Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.
const_iterator Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::end | ( | ) | const |
Get const_iterator pointing past the last element in the sequence.
|
overridevirtual |
Erase a value at specified index.
The sequence will shrink.
index | [in] - Index of the value to be removed. |
Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::front | ( | ) | const |
Get a const reference to the first value in the sequence.
|
overridevirtual |
Get the ordinal value of the value at the specified index.
index | [in] - Index of the value to get. |
std::out_of_range | exception if index is not in range |
Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.
ContainedType Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::GetVal | ( | const size_t | index | ) | const |
Get the value at the specified index.
index | [in] - Index of the value to get. |
std::out_of_range | exception if index is not in range |
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.
index | [in] - Index of the new value. |
value | [in] - Value to insert. |
References Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::InsertOrdinalAt().
|
overridevirtual |
Insert a new ordinal value at specified index, growing the sequence.
index | [in] - Index of the new value. |
value | [in] - Value to insert. |
IllegalValueException | if 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().
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.
index | [in] - Index of the value to get. |
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.
val | [in] - Value to be inserted. |
References Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::PushBackOrdinal().
|
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.
val | [in] - Value to be inserted. |
IllegalValueException | if 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().
|
overridevirtual |
Update a specific value, using ordinal value.
Will not add new values to the sequence.
index | [in] - Index of the value to set. |
val | [in] - Value to set. |
std::out_of_range | exception if index is not in range |
IllegalValueException | if 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().
void Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::SetVal | ( | const size_t | index, |
const ContainedType | val ) |
Update a specific value.
Will not add new values.
index | [in] - Index of the value to set. |
val | [in] - Value to set. |
std::out_of_range | exception if index is not in range |
References Safir::Dob::Typesystem::EnumerationSequenceContainer< T >::SetOrdinal().
|
overridevirtual |
Get the size of the sequence, i.e number of contained values.
Implements Safir::Dob::Typesystem::EnumerationSequenceContainerBase.