Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::ObjectContainerImpl< Object > Class Reference

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>

Inheritance diagram for Safir::Dob::Typesystem::ObjectContainerImpl< Object >:
[legend]
Collaboration diagram for Safir::Dob::Typesystem::ObjectContainerImpl< Object >:
[legend]

Public Types

typedef std::shared_ptr< ObjectT_Ptr
 Typedef for the contained smart pointer.
 
typedef T_Ptr ContainedType
 

Public Member Functions

 ObjectContainerImpl ()
 Default constructor.
 
 ObjectContainerImpl (const ObjectContainerImpl &other)
 Copy constructor.
 
ObjectContainerImploperator= (const ObjectContainerImpl &other)
 Copy assignment operator.
 
void SetPtr (const ObjectPtr &ptr) override
 Set the smart pointer in the container.
 
const T_PtrGetPtr () const
 Get the smart pointer from the container.
 
Objectoperator-> () 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.
 
ContainerBaseGetMember (const int member, const int index) override
 Get a reference to a member container from an object.
 
const ContainerBaseGetMember (const int member, const int index) const override
 Get a const reference to a member container from an object.
 
- Public Member Functions inherited from Safir::Dob::Typesystem::ObjectContainerBase
 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.
 
- Public Member Functions inherited from Safir::Dob::Typesystem::ContainerBase
constexpr ContainerBase ()
 Default Constructor.
 
constexpr ContainerBase (const ContainerBase &)=default
 Copy constructor.
 
virtual ~ContainerBase ()
 Virtual destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from Safir::Dob::Typesystem::ObjectContainerBase
ObjectContainerBaseoperator= (const ObjectContainerBase &other)
 Copy assignment operator.
 
- Protected Member Functions inherited from Safir::Dob::Typesystem::ContainerBase
ContainerBaseoperator= (const ContainerBase &other)
 Copy assignment operator.
 
- Protected Attributes inherited from Safir::Dob::Typesystem::ContainerBase
bool m_bIsChanged
 The variable containing the change flag.
 

Detailed Description

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.

Member Typedef Documentation

◆ ContainedType

◆ T_Ptr

typedef std::shared_ptr<Object> Safir::Dob::Typesystem::ObjectContainerImpl< Object >::T_Ptr

Typedef for the contained smart pointer.

Constructor & Destructor Documentation

◆ ObjectContainerImpl() [1/2]

Default constructor.

Creates a null and not changed container.

◆ ObjectContainerImpl() [2/2]

Copy constructor.

Copy an object container. The contained object will be cloned.

Parameters
other[in] - The object to copy.

References Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().

Here is the call graph for this function:

Member Function Documentation

◆ Copy()

void Safir::Dob::Typesystem::ObjectContainerImpl< Object >::Copy ( const ContainerBase & that)
overridevirtual

Virtual assignment.

Copy all the members from "that" into "this". Types must be the same for this to work!

Parameters
that[in] - The object to copy into this.
Exceptions
SoftwareViolationExceptionIf 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().

Here is the call graph for this function:

◆ GetMember() [1/2]

const ContainerBase & Safir::Dob::Typesystem::ObjectContainerImpl< Object >::GetMember ( const int member,
const int index ) const
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!

Parameters
member[in] - The index of the member to get.
index[in] - The array index of the member to get.
Returns
A const reference to the member container.
Exceptions
IllegalValueExceptionIf the index is not in the range of the array.
SoftwareViolationExceptionIf 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().

Here is the call graph for this function:

◆ GetMember() [2/2]

ContainerBase & Safir::Dob::Typesystem::ObjectContainerImpl< Object >::GetMember ( const int member,
const int index )
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!

Parameters
member[in] - The index of the member to get.
index[in] - The array index of the member to get.
Returns
A reference to the member container.
Exceptions
IllegalValueExceptionIf the index is not in the range of the array.
SoftwareViolationExceptionIf 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().

Here is the call graph for this function:

◆ GetPtr()

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.

Returns
A smart pointer to the contained object.
Exceptions
NullExceptionThe container is null.

References __WFILE__, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().

Here is the call graph for this function:

◆ IsChanged()

bool Safir::Dob::Typesystem::ObjectContainerImpl< Object >::IsChanged ( ) const
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.

Returns
True if the containers change flag is set.

Reimplemented from Safir::Dob::Typesystem::ContainerBase.

References Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull(), and Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.

Here is the call graph for this function:

◆ IsNull()

bool Safir::Dob::Typesystem::ObjectContainerImpl< Object >::IsNull ( ) const
overridevirtual

Is the container set to null?

Returns
True if the container is set to null.

Implements Safir::Dob::Typesystem::ContainerBase.

◆ operator->()

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.

Returns
A pointer to the contained object.
Exceptions
NullExceptionThe container is null.

References __WFILE__, and Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull().

Here is the call graph for this function:

◆ operator=()

Copy assignment operator.

Parameters
other[in] - The object to copy.
Returns
A reference to this.

References Safir::Dob::Typesystem::ObjectContainerImpl< T >::IsNull(), and Safir::Dob::Typesystem::ObjectContainerBase::operator=().

Here is the call graph for this function:

◆ SetChanged()

void Safir::Dob::Typesystem::ObjectContainerImpl< Object >::SetChanged ( const bool changed)
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.

Parameters
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.

Here is the call graph for this function:

◆ SetNull()

void Safir::Dob::Typesystem::ObjectContainerImpl< Object >::SetNull ( )
overridevirtual

◆ SetPtr()

void Safir::Dob::Typesystem::ObjectContainerImpl< Object >::SetPtr ( const ObjectPtr & ptr)
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.

Parameters
ptr[in] A pointer to the new object to point to.
Exceptions
IncompatibleTypesExceptionIf the ptr is not of the type contained by the container.

Implements Safir::Dob::Typesystem::ObjectContainerBase.

References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.