![]() |
Safir SDK Core
|
#include <Safir/Dob/Typesystem/SequenceContainer.h>
Public Types | |
typedef std::shared_ptr< T > | T_Ptr |
Typedef for the contained smart pointer. | |
![]() | |
typedef T | ContainedType |
typedef std::deque< T > | StorageType |
typedef StorageType::const_iterator | const_iterator |
Public Member Functions | |
bool | IsChanged () const override |
Is the change flag set on the container? | |
bool | IsChangedHere () const override |
Is the change flag in the container set? | |
void | SetChanged (const bool changed) override |
Set the containers change flag. | |
void | SetChangedHere (const bool changed) override |
Set the change flag in the container. | |
size_t | size () const override |
Get the size of the sequence, i.e number of contained values. | |
ObjectPtr | GetObj (const size_t index) override |
Get a generic pointer to the object at the specified index. | |
ObjectConstPtr | GetObj (const size_t index) const override |
Get a const generic pointer to the object at the specified index. | |
T_Ptr | GetPtr (const size_t index) |
Get the object at the specified index. | |
ObjectPtr | GetObjectPointer (const size_t index) override |
Get a generic pointer to the object at the specified index. | |
std::shared_ptr< const T > | GetPtr (const size_t index) const |
Get the object at the specified index, const version. | |
ObjectConstPtr | GetObjectPointer (const size_t index) const override |
Get a const generic pointer to the object at the specified index. | |
void | SetPtr (const size_t index, const T_Ptr &ptr) |
Set a the object pointer a the specified index. | |
void | SetObjectPointer (const size_t index, const ObjectPtr &ptr) override |
Set the smart pointer at a certain index in the container. | |
void | PushBackObjectPointer (const ObjectPtr &ptr) override |
Insert a new object last in the sequence. | |
![]() | |
SequenceContainer () | |
Default Constructor. | |
bool | IsNull () const override |
Is the container set to null? | |
void | SetNull () override |
Set the container to null. | |
size_t | size () const |
Get the size of the sequence, i.e number of contained values. | |
bool | empty () const |
Check if sequence is empty. | |
const ContainedType & | front () const |
Get a const reference to the first value in the sequence. | |
const 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 () |
Clear the sequence, i.e remove all values. | |
const ContainedType & | operator[] (const size_t index) const |
Get const reference to the value with specified index. | |
const ContainedType & | at (const size_t index) const |
Get const reference to the value with specified index. | |
void | push_back (const ContainedType &val) |
Insert a new value last in the sequence. | |
void | SetVal (const size_t index, const ContainedType &val) |
Update a specific value. | |
const ContainedType & | GetVal (const size_t index) const |
Get const reference to the value with specified index. | |
void | InsertAt (const size_t index, const ContainedType &value) |
Insert a new value at specified index. | |
void | EraseAt (const size_t index) |
Erase a value at specified index. | |
void | Copy (const ContainerBase &that) override |
Copy all the members from "that" into "this". | |
![]() | |
constexpr | ContainerBase () |
Default Constructor. | |
constexpr | ContainerBase (const ContainerBase &)=default |
Copy constructor. | |
virtual | ~ContainerBase () |
Virtual destructor. | |
Reflection part. | |
These methods allow applications to manipulate the members of objects without having been compiled against it. There should be no reason for most applications to use these methods. |
Additional Inherited Members | |
![]() | |
ContainerBase & | operator= (const ContainerBase &other) |
Copy assignment operator. | |
![]() | |
bool | m_bIsChanged |
The variable containing the change flag. | |
typedef std::shared_ptr<T> Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::T_Ptr |
Typedef for the contained smart pointer.
|
overridevirtual |
Get a const generic pointer to the object at the specified index.
Note: Unless you know that you need to use the reflection interface you should prefer to use the functions in GenericObjectSequenceContainer.
Indexing outside the sequence provokes undefined behavior.
index | [in] - The index of the object to get. |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::operator[]().
|
overridevirtual |
Get a generic pointer to the object at the specified index.
Note: Unless you know that you need to use the reflection interface you should prefer to use the functions in GenericObjectSequenceContainer.
Indexing outside the sequence provokes undefined behavior.
index | [in] - The index of the object to get. |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::operator[]().
|
overridevirtual |
Get a const generic pointer to the object at the specified index.
index | [in] - The index of the object to get. |
std::out_of_range | exception if index is not in range |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::GetPtr().
|
overridevirtual |
Get a generic pointer to the object at the specified index.
index | [in] - The index of the object to get. |
std::out_of_range | exception if index is not in range |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::GetPtr().
T_Ptr Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::GetPtr | ( | const size_t | index | ) |
Get the object at the specified index.
index | [in] - Index of the value to get. |
std::out_of_range | exception if index is not in range |
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::at().
Referenced by Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::GetObjectPointer(), and Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::GetObjectPointer().
std::shared_ptr< const T > Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::GetPtr | ( | const size_t | index | ) | const |
Get the object at the specified index, const version.
index | [in] - Index of the value to get. |
std::out_of_range | exception if index is not in range |
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::at().
|
overridevirtual |
Is the change flag set on the container?
The change flag gets updated every time the contained value changes.
Note: If this is a container containing objects this call will recursively check change flags in the contained objects.
Reimplemented from Safir::Dob::Typesystem::ContainerBase.
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::begin(), Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::end(), and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Is the change flag in the container set?
This method is like IsChanged without the recursion.
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Insert a new object last in the sequence.
If the sequence was null before it will no longer be null after this call. Change flag is updated.
ptr | [in] - Object to be inserted. |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References __WFILE__, and Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::push_back().
|
overridevirtual |
Set the containers change flag.
It should be fairly unusual for an application to have to use this operation. There is nothing dangerous about it, but are you sure this is the operation you were after?
The change flag is how receivers of objects can work out what the sender really wanted done on the object.
Note: If this is a container containing one or more objects this call will recursively set all the change flags in the contained objects.
changed | [in] - The value to set the change flag(s) to. |
Reimplemented from Safir::Dob::Typesystem::ContainerBase.
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::begin(), Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::end(), and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Set the change flag in the container.
This method is like SetChanged without the recursion
changed | [in] - The value to set the change flag to. |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Set the smart pointer at a certain index in the container.
This method will set the contained pointer to point to another object. Change flag is updated.
ptr | [in] A pointer to the new object to point to. |
index | [in] - The index of the object to set. |
std::out_of_range | exception if index is not in range |
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References __WFILE__, and Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::SetPtr().
void Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::SetPtr | ( | const size_t | index, |
const T_Ptr & | ptr ) |
Set a the object pointer a the specified index.
index | [in] - Index of the object to set. |
ptr | [in] - Object to set. |
std::out_of_range | exception if index is not in range |
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::SetVal().
Referenced by Safir::Dob::Typesystem::GenericObjectSequenceContainer< T >::SetObjectPointer().
|
overridevirtual |
Get the size of the sequence, i.e number of contained values.
Implements Safir::Dob::Typesystem::GenericObjectSequenceContainerBase.
References Safir::Dob::Typesystem::SequenceContainer< std::shared_ptr< T > >::size().