Safir SDK Core
|
Template class for all containers of automatically generated DOB objects. More...
#include <Safir/Dob/Typesystem/ObjectContainer.h>
Public Types | |
typedef boost::shared_ptr< T > | T_Ptr |
Typedef for the contained smart pointer. More... | |
typedef T_Ptr | ContainedType |
Public Member Functions | |
ObjectContainerImpl () | |
Default constructor. More... | |
ObjectContainerImpl (const ObjectContainerImpl &other) | |
Copy constructor. More... | |
ObjectContainerImpl & | operator= (const ObjectContainerImpl &other) |
Copy assignment operator. More... | |
void | SetPtr (const T_Ptr &ptr) |
Set the smart pointer in the container. More... | |
virtual void | SetPtr (const ObjectPtr &ptr) |
Set the smart pointer in the container. More... | |
const T_Ptr & | GetPtr () const |
Get the smart pointer from the container. More... | |
T *const | operator-> () const |
Dereference the smart pointer in the container. More... | |
virtual void | SetChanged (const bool changed) |
Set the containers change flag. More... | |
virtual bool | IsChanged () const |
Is the change flag set on the container? The change flag gets updated every time the contained value changes. More... | |
virtual bool | IsNull () const |
Is the container set to null? More... | |
virtual void | SetNull () |
Set the container to null. More... | |
virtual void | Copy (const ContainerBase &that) |
Virtual assignment. More... | |
virtual ContainerBase & | GetMember (const int member, const int index) |
Get a reference to a member container from an object. More... | |
virtual const ContainerBase & | GetMember (const int member, const int index) const |
Get a const reference to a member container from an object. More... | |
virtual const ObjectPtr | GetObjectPointer () const |
Get a smart pointer to the contained object. More... | |
virtual void | SetObjectPointer (const ObjectPtr ptr) |
Set the smart pointer in the container. More... | |
virtual void | ResetObjectPointer () |
Reset (ie set to null) the contained pointer. More... | |
Blob serialization/deserialization part. | |
These functions are for internal use only! Their names and functionality are likely to change in the near future! | |
Int32 | CalculateBlobSize () const |
Calculate the size of the blob-serialized form of the contained object. More... | |
Public Member Functions inherited from Safir::Dob::Typesystem::ObjectContainerBase | |
ObjectContainerBase () | |
Default constructor. More... | |
bool | IsChangedHere () const |
Is the change flag in the container set? More... | |
void | SetChangedHere (const bool changed) |
Set the change flag in the container. 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::ObjectContainerBase | |
ObjectContainerBase & | operator= (const ObjectContainerBase &other) |
Copy assignment operator. More... | |
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... | |
Template class for all containers of automatically generated DOB objects.
This class holds a smart pointer to an object, and has operations to get information from it and modify it. The -> operator is overloaded to make this class more transparent to use.
It is called ObjectContainerImpl because the name ObjectContainer is "taken" by the container that contains a Dob::Typesystem::Object object.
T | The type to contain. Must inherit from Dob::Typesystem::Object. |
typedef T_Ptr Safir::Dob::Typesystem::ObjectContainerImpl< T >::ContainedType |
typedef boost::shared_ptr<T> Safir::Dob::Typesystem::ObjectContainerImpl< T >::T_Ptr |
Typedef for the contained smart pointer.
Safir::Dob::Typesystem::ObjectContainerImpl< T >::ObjectContainerImpl | ( | ) |
Default constructor.
Creates a null and not changed container.
Safir::Dob::Typesystem::ObjectContainerImpl< T >::ObjectContainerImpl | ( | const ObjectContainerImpl< T > & | other | ) |
Copy constructor.
Copy an object container. The contained object will be cloned.
other | [in] - The object to copy. |
IncompatibleTypesException | Something has gone horribly wrong with your copying! |
Int32 Safir::Dob::Typesystem::ObjectContainerImpl< T >::CalculateBlobSize | ( | ) | const |
Calculate the size of the blob-serialized form of the contained object.
|
virtual |
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.
|
virtual |
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.
|
virtual |
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.
|
virtual |
Get a smart pointer to the contained object.
This method will cast the smart object pointer to the derived type contained by the container to a smart pointer to an Object (the DOB object base class.
This method does not check if the container is null!
Note: Do not use this method unless you're very sure it is the one you need!
Implements Safir::Dob::Typesystem::ObjectContainerBase.
const T_Ptr& Safir::Dob::Typesystem::ObjectContainerImpl< T >::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. |
|
virtual |
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 an object this call will recursively check change flags in the contained object.
Reimplemented from Safir::Dob::Typesystem::ContainerBase.
|
virtual |
Is the container set to null?
Implements Safir::Dob::Typesystem::ContainerBase.
Referenced by Safir::Dob::Typesystem::ObjectContainerImpl< U >::CalculateBlobSize(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::GetMember(), Safir::Dob::Typesystem::ObjectContainerImpl< Object >::GetMember(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::GetPtr(), Safir::Dob::Typesystem::ObjectContainerImpl< Object >::GetPtr(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::IsChanged(), Safir::Dob::Typesystem::ObjectContainerImpl< Object >::IsChanged(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::ObjectContainerImpl(), Safir::Dob::Typesystem::ObjectContainerImpl< Object >::ObjectContainerImpl(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::operator->(), Safir::Dob::Typesystem::ObjectContainerImpl< Object >::operator->(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::operator=(), Safir::Dob::Typesystem::ObjectContainerImpl< Object >::operator=(), Safir::Dob::Typesystem::ObjectContainerImpl< U >::SetChanged(), and Safir::Dob::Typesystem::ObjectContainerImpl< Object >::SetChanged().
T* const Safir::Dob::Typesystem::ObjectContainerImpl< T >::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. |
ObjectContainerImpl& Safir::Dob::Typesystem::ObjectContainerImpl< T >::operator= | ( | const ObjectContainerImpl< T > & | other | ) |
Copy assignment operator.
other | [in] - The object to copy. |
IncompatibleTypesException | The contained types are not compatible! |
|
virtual |
Reset (ie set to null) the contained pointer.
Warning: This method does not update the change flag!
Note: Do not use this method unless you're very sure it is the one you need!
Implements Safir::Dob::Typesystem::ObjectContainerBase.
|
virtual |
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 an object this call will recursively set all the change flags in the contained object.
changed | [in] - The value to set the change flag(s) to. |
Reimplemented from Safir::Dob::Typesystem::ContainerBase.
|
virtual |
Set the container to null.
Implements Safir::Dob::Typesystem::ContainerBase.
|
virtual |
Set the smart pointer in the container.
This method will set the contained pointer to point to another object. Checks are NOT always made to see that it is of the correct type.
Warning: This method does not update the change flag!
Note: Do not use this method unless you're very sure it is the one you need!
ptr | [in] A pointer to the new object to point to. |
Implements Safir::Dob::Typesystem::ObjectContainerBase.
Referenced by Safir::Dob::Typesystem::ObjectContainerImpl< U >::Copy(), and Safir::Dob::Typesystem::ObjectContainerImpl< Object >::Copy().
void Safir::Dob::Typesystem::ObjectContainerImpl< T >::SetPtr | ( | const T_Ptr & | ptr | ) |
Set the smart pointer in the container.
This method will set the contained pointer to point to another object. The change flag of the container will be updated.
ptr | [in] A pointer to the new object to point to. |
|
virtual |
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.