![]() |
Safir SDK Core
|
This is a specialization of the ObjectContainerImpl template for the case where the template argument is Dob::Typesystem::Object. More...
#include <Safir/Dob/Typesystem/ObjectContainer.h>
Public Types | |
typedef std::shared_ptr< Object > | T_Ptr |
Typedef for the contained smart pointer. | |
typedef T_Ptr | ContainedType |
Public Member Functions | |
ObjectContainerImpl () | |
Default constructor. | |
ObjectContainerImpl (const ObjectContainerImpl &other) | |
Copy constructor. | |
ObjectContainerImpl & | operator= (const ObjectContainerImpl &other) |
Copy assignment operator. | |
void | SetPtr (const ObjectPtr &ptr) override |
Set the smart pointer in the container. | |
const T_Ptr & | GetPtr () const |
Get the smart pointer from the container. | |
Object * | operator-> () const |
Dereference the smart pointer in the container. | |
void | SetChanged (const bool changed) override |
Set the containers change flag. | |
bool | IsChanged () const override |
Is the change flag set on the container? | |
bool | IsNull () const override |
Is the container set to null? | |
void | SetNull () override |
Set the container to null. | |
void | Copy (const ContainerBase &that) override |
Virtual assignment. | |
ContainerBase & | GetMember (const int member, const int index) override |
Get a reference to a member container from an object. | |
const ContainerBase & | GetMember (const int member, const int index) const override |
Get a const reference to a member container from an object. | |
![]() | |
ObjectContainerBase () | |
Default constructor. | |
ObjectContainerBase (const ObjectContainerBase &)=default | |
Copy constructor. | |
bool | IsChangedHere () const |
Is the change flag in the container set? | |
void | SetChangedHere (const bool changed) |
Set the change flag in the container. | |
![]() | |
constexpr | ContainerBase () |
Default Constructor. | |
constexpr | ContainerBase (const ContainerBase &)=default |
Copy constructor. | |
virtual | ~ContainerBase () |
Virtual destructor. | |
Additional Inherited Members | |
![]() | |
ObjectContainerBase & | operator= (const ObjectContainerBase &other) |
Copy assignment operator. | |
![]() | |
ContainerBase & | operator= (const ContainerBase &other) |
Copy assignment operator. | |
![]() | |
bool | m_bIsChanged |
The variable containing the change flag. | |
This is a specialization of the ObjectContainerImpl template for the case where the template argument is Dob::Typesystem::Object.
The reason that this is needed is that for example the SetPtr function will be multiply defined if the ObjectContainerImpl is instantiated with Object.
typedef T_Ptr Safir::Dob::Typesystem::ObjectContainerImpl< Object >::ContainedType |
typedef std::shared_ptr<Object> Safir::Dob::Typesystem::ObjectContainerImpl< Object >::T_Ptr |
Typedef for the contained smart pointer.
Safir::Dob::Typesystem::ObjectContainerImpl< Object >::ObjectContainerImpl | ( | ) |
Default constructor.
Creates a null and not changed container.
Safir::Dob::Typesystem::ObjectContainerImpl< Object >::ObjectContainerImpl | ( | const ObjectContainerImpl< Object > & | other | ) |
Copy constructor.
Copy an object container. The contained object will be cloned.
other | [in] - The object to copy. |
References Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().
|
overridevirtual |
Virtual assignment.
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__, Safir::Dob::Typesystem::ContainerBase::IsNull(), Safir::Dob::Typesystem::ContainerBase::m_bIsChanged, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::SetObjectPointer().
|
overridevirtual |
Get a const reference to a member container from an object.
Use the methods in Members to get member indices and array sizes for use with this method.
Note: Do not use this method unless you're very sure it is the one you need!
member | [in] - The index of the member to get. |
index | [in] - The array index of the member to get. |
IllegalValueException | If the index is not in the range of the array. |
SoftwareViolationException | If the element is not an array and the index is not 0. |
Implements Safir::Dob::Typesystem::ObjectContainerBase.
References __WFILE__, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().
|
overridevirtual |
Get a reference to a member container from an object.
Use the methods in Members to get member indices and array sizes for use with this method.
Note: Do not use this method unless you're very sure it is the one you need!
member | [in] - The index of the member to get. |
index | [in] - The array index of the member to get. |
IllegalValueException | If the index is not in the range of the array. |
SoftwareViolationException | If the element is not an array and the index is not 0. |
Implements Safir::Dob::Typesystem::ObjectContainerBase.
References __WFILE__, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().
const T_Ptr & Safir::Dob::Typesystem::ObjectContainerImpl< Object >::GetPtr | ( | ) | const |
Get the smart pointer from the container.
This method will return the contained smart pointer unless the container is null, then an exception will be thrown.
NullException | The container is null. |
References __WFILE__, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().
|
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::ObjectContainerImpl< T >::IsNull(), and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Is the container set to null?
Implements Safir::Dob::Typesystem::ContainerBase.
Object * Safir::Dob::Typesystem::ObjectContainerImpl< Object >::operator-> | ( | ) | const |
Dereference the smart pointer in the container.
This method will call the -> operator on the smart pointer in the container to allow users to directly access members in the object.
NullException | The container is null. |
References __WFILE__, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().
ObjectContainerImpl & Safir::Dob::Typesystem::ObjectContainerImpl< Object >::operator= | ( | const ObjectContainerImpl< Object > & | other | ) |
Copy assignment operator.
other | [in] - The object to copy. |
References Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull(), and Safir::Dob::Typesystem::ObjectContainerBase::operator=().
|
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::ObjectContainerImpl< T >::IsNull(), and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Set the container to null.
Implements Safir::Dob::Typesystem::ContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
|
overridevirtual |
Set the smart pointer in the container.
This method will set the contained pointer to point to another object. Checks are always made to see that it is of the correct type. The change flag of the container will be updated.
ptr | [in] A pointer to the new object to point to. |
IncompatibleTypesException | If the ptr is not of the type contained by the container. |
Implements Safir::Dob::Typesystem::ObjectContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.