Safir SDK Core
|
Container class for sequences of values. More...
#include <Safir/Dob/Typesystem/SequenceContainer.h>
Public Types | |
typedef T | ContainedType |
typedef boost::container::vector< T > | StorageType |
typedef StorageType::const_iterator | const_iterator |
Public Member Functions | |
SequenceContainer () | |
Default Constructor. More... | |
virtual bool | IsNull () const |
Is the container set to null? More... | |
virtual void | SetNull () |
Set the container to null. More... | |
virtual bool | IsChanged () const |
IsChanged - Check if the sequence has changed. More... | |
virtual void | SetChanged (const bool changed) |
SetChanged - Set the change state of the sequence. More... | |
size_t | size () const |
size - Get the size of the sequence, i.e number of contained values. More... | |
bool | empty () const |
empty - Check if sequence is empty. More... | |
const ContainedType & | front () const |
front - Get a const reference to the first value in the sequence. More... | |
const ContainedType & | back () const |
back - Get a const reference to the last value in the sequence. More... | |
const_iterator | begin () const |
begin - Get const_iterator pointing to the first element in the sequence. More... | |
const_iterator | end () const |
end - Get const_iterator pointing past the last element in the sequence. More... | |
void | clear () |
clear - Clear the sequence, i.e remove all values. More... | |
const ContainedType & | operator[] (size_t index) const |
operator [] - Get const reference to the value with specified index. More... | |
void | push_back (const ContainedType &val) |
push_back - Insert a new value last in the sequence. More... | |
void | SetVal (size_t index, const ContainedType &val) |
SetVal - Update a specific value. More... | |
const ContainedType & | GetVal (size_t index) const |
GetVal - Get const reference to the value with specified index. More... | |
void | InsertAt (size_t index, const ContainedType &value) |
InsertAt - Insert a new value at specified index. More... | |
void | EraseAt (size_t index) |
EraseAt - Erase a value at specified index. More... | |
virtual void | Copy (const ContainerBase &that) |
Copy - Copy all the members from "that" into "this". More... | |
Public Member Functions inherited from Safir::Dob::Typesystem::ContainerBase | |
ContainerBase () | |
Default Constructor. More... | |
virtual | ~ContainerBase () |
Virtual destructor. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Safir::Dob::Typesystem::ContainerBase | |
ContainerBase & | operator= (const ContainerBase &other) |
Copy assignment operator. More... | |
Protected Attributes inherited from Safir::Dob::Typesystem::ContainerBase | |
bool | m_bIsChanged |
The variable containing the change flag. More... | |
Container class for sequences of values.
A sequence is a collection of values that can dynamically grow or shrink in size. The whole container has a change flag that will automatically be set when values are added, removed or changed. Values in a sequence cannot be null and does not have change flags.
typedef StorageType::const_iterator Safir::Dob::Typesystem::SequenceContainer< T >::const_iterator |
typedef T Safir::Dob::Typesystem::SequenceContainer< T >::ContainedType |
typedef boost::container::vector<T> Safir::Dob::Typesystem::SequenceContainer< T >::StorageType |
Safir::Dob::Typesystem::SequenceContainer< T >::SequenceContainer | ( | ) |
Default Constructor.
Construct a container that is not changed and not null.
const ContainedType& Safir::Dob::Typesystem::SequenceContainer< T >::back | ( | ) | const |
back - Get a const reference to the last value in the sequence.
const_iterator Safir::Dob::Typesystem::SequenceContainer< T >::begin | ( | ) | const |
begin - Get const_iterator pointing to the first element in the sequence.
void Safir::Dob::Typesystem::SequenceContainer< T >::clear | ( | ) |
clear - Clear the sequence, i.e remove all values.
After a call to clear the sequence will be empty but not automatically set to null.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
virtual |
Copy - Copy all the members from "that" into "this".
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.
bool Safir::Dob::Typesystem::SequenceContainer< T >::empty | ( | ) | const |
empty - Check if sequence is empty.
const_iterator Safir::Dob::Typesystem::SequenceContainer< T >::end | ( | ) | const |
end - Get const_iterator pointing past the last element in the sequence.
void Safir::Dob::Typesystem::SequenceContainer< T >::EraseAt | ( | size_t | index | ) |
EraseAt - Erase a value at specified index.
The sequence will shrink.
index | [in] - Index of the value to be removed. |
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
const ContainedType& Safir::Dob::Typesystem::SequenceContainer< T >::front | ( | ) | const |
front - Get a const reference to the first value in the sequence.
const ContainedType& Safir::Dob::Typesystem::SequenceContainer< T >::GetVal | ( | size_t | index | ) | const |
GetVal - Get const reference to the value with specified index.
index | [in] - Index of the value to get. |
void Safir::Dob::Typesystem::SequenceContainer< T >::InsertAt | ( | size_t | index, |
const ContainedType & | value | ||
) |
InsertAt - Insert a new value at specified index.
The sequence size will grow.
index | [in] - Index of the new value. |
value | [in] - Value to insert. |
|
virtual |
IsChanged - Check if the sequence has changed.
Reimplemented from Safir::Dob::Typesystem::ContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
virtual |
Is the container set to null?
Implements Safir::Dob::Typesystem::ContainerBase.
const ContainedType& Safir::Dob::Typesystem::SequenceContainer< T >::operator[] | ( | size_t | index | ) | const |
operator [] - Get const reference to the value with specified index.
index | [in] - Index of the value to get. |
void Safir::Dob::Typesystem::SequenceContainer< T >::push_back | ( | const ContainedType & | val | ) |
push_back - 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::ContainerBase::m_bIsChanged.
|
virtual |
SetChanged - Set the change state of the sequence.
changed | [in] - If true, the sequence is set to changed, it is set to not changed. |
Reimplemented from Safir::Dob::Typesystem::ContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
virtual |
void Safir::Dob::Typesystem::SequenceContainer< T >::SetVal | ( | size_t | index, |
const ContainedType & | val | ||
) |
SetVal - Update a specific value.
Will not add new values.
index | [in] - Index of the value to set. |
val | [in] - Value to set. |
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
size_t Safir::Dob::Typesystem::SequenceContainer< T >::size | ( | ) | const |
size - Get the size of the sequence, i.e number of contained values.