Safir SDK Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Safir::Dob::Typesystem::ObjectContainerBase Class Referenceabstract

Base class for all object containers. More...

#include <Safir/Dob/Typesystem/ObjectContainer.h>

Inheritance diagram for Safir::Dob::Typesystem::ObjectContainerBase:
[legend]
Collaboration diagram for Safir::Dob::Typesystem::ObjectContainerBase:
[legend]

Public Member Functions

 ObjectContainerBase ()
 Default constructor.
 
 ObjectContainerBase (const ObjectContainerBase &)=default
 Copy constructor.
 
virtual void SetPtr (const ObjectPtr &ptr)=0
 Set the smart pointer in the container.
 
bool IsChangedHere () const
 Is the change flag in the container set?
 
void SetChangedHere (const bool changed)
 Set the change flag in the container.
 
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.

virtual ContainerBaseGetMember (const int member, const int index)=0
 Get a reference to a member container from an object.
 
virtual const ContainerBaseGetMember (const int member, const int index) const =0
 Get a const reference to a member container from an object.
 
virtual const ObjectPtr GetObjectPointer () const =0
 Get a smart pointer to the contained object.
 
virtual void SetObjectPointer (const ObjectPtr ptr)=0
 Set the smart pointer in the container.
 
virtual void ResetObjectPointer ()=0
 Reset (ie set to null) the contained pointer.
 
- Public Member Functions inherited from Safir::Dob::Typesystem::ContainerBase
constexpr ContainerBase ()
 Default Constructor.
 
constexpr ContainerBase (const ContainerBase &)=default
 Copy constructor.
 
virtual ~ContainerBase ()
 Virtual destructor.
 
virtual bool IsNull () const =0
 Is the container set to null?
 
virtual void SetNull ()=0
 Set the container to null.
 
virtual bool IsChanged () const
 Is the change flag set on the container?
 
virtual void SetChanged (const bool changed)
 Set the containers change flag.
 
virtual void Copy (const ContainerBase &that)=0
 Virtual assignment.
 

Protected Member Functions

ObjectContainerBaseoperator= (const ObjectContainerBase &other)
 Copy assignment operator.
 
- Protected Member Functions inherited from Safir::Dob::Typesystem::ContainerBase
ContainerBaseoperator= (const ContainerBase &other)
 Copy assignment operator.
 

Friends

class Safir::Dob::Typesystem::Internal::BlobOperations
 

Additional Inherited Members

- Protected Attributes inherited from Safir::Dob::Typesystem::ContainerBase
bool m_bIsChanged
 The variable containing the change flag.
 

Detailed Description

Base class for all object containers.

The reason for the existence of this class is that code that uses the reflection functionality must be able to get hold of members of items.

Constructor & Destructor Documentation

◆ ObjectContainerBase() [1/2]

Safir::Dob::Typesystem::ObjectContainerBase::ObjectContainerBase ( )

Default constructor.

◆ ObjectContainerBase() [2/2]

Safir::Dob::Typesystem::ObjectContainerBase::ObjectContainerBase ( const ObjectContainerBase & )
default

Copy constructor.

Member Function Documentation

◆ GetMember() [1/2]

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

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.

Implemented in Safir::Dob::Typesystem::ObjectContainerImpl< T >, Safir::Dob::Typesystem::ObjectContainerImpl< ClassType >, Safir::Dob::Typesystem::ObjectContainerImpl< Entity >, Safir::Dob::Typesystem::ObjectContainerImpl< Safir::Dob::Typesystem::Object >, Safir::Dob::Typesystem::ObjectContainerImpl< U >, and Safir::Dob::Typesystem::ObjectContainerImpl< Object >.

◆ GetMember() [2/2]

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

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.

Implemented in Safir::Dob::Typesystem::ObjectContainerImpl< T >, Safir::Dob::Typesystem::ObjectContainerImpl< ClassType >, Safir::Dob::Typesystem::ObjectContainerImpl< Entity >, Safir::Dob::Typesystem::ObjectContainerImpl< Safir::Dob::Typesystem::Object >, Safir::Dob::Typesystem::ObjectContainerImpl< U >, and Safir::Dob::Typesystem::ObjectContainerImpl< Object >.

◆ GetObjectPointer()

virtual const ObjectPtr Safir::Dob::Typesystem::ObjectContainerBase::GetObjectPointer ( ) const
pure 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!

Returns
A smart pointer to the contained object.

Implemented in Safir::Dob::Typesystem::ObjectContainerImpl< T >, Safir::Dob::Typesystem::ObjectContainerImpl< ClassType >, Safir::Dob::Typesystem::ObjectContainerImpl< Entity >, Safir::Dob::Typesystem::ObjectContainerImpl< Safir::Dob::Typesystem::Object >, and Safir::Dob::Typesystem::ObjectContainerImpl< U >.

◆ IsChangedHere()

bool Safir::Dob::Typesystem::ObjectContainerBase::IsChangedHere ( ) const

Is the change flag in the container set?

This method is like IsChanged without the recursion (on object containers IsChanged is recursive).

Returns
True if the containers change flag is set.

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

◆ operator=()

ObjectContainerBase & Safir::Dob::Typesystem::ObjectContainerBase::operator= ( const ObjectContainerBase & other)
protected

Copy assignment operator.

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

References Safir::Dob::Typesystem::ContainerBase::operator=().

Referenced by Safir::Dob::Typesystem::ObjectContainerImpl< T >::operator=(), and Safir::Dob::Typesystem::ObjectContainerImpl< Object >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetObjectPointer()

virtual void Safir::Dob::Typesystem::ObjectContainerBase::ResetObjectPointer ( )
pure 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!

Implemented in Safir::Dob::Typesystem::ObjectContainerImpl< T >, Safir::Dob::Typesystem::ObjectContainerImpl< ClassType >, Safir::Dob::Typesystem::ObjectContainerImpl< Entity >, Safir::Dob::Typesystem::ObjectContainerImpl< Safir::Dob::Typesystem::Object >, and Safir::Dob::Typesystem::ObjectContainerImpl< U >.

◆ SetChangedHere()

void Safir::Dob::Typesystem::ObjectContainerBase::SetChangedHere ( const bool changed)

Set the change flag in the container.

This method is like SetChanged without the recursion (on object containers SetChanged is recursive).

Parameters
changed[in] - The value to set the change flag to.

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

◆ SetObjectPointer()

virtual void Safir::Dob::Typesystem::ObjectContainerBase::SetObjectPointer ( const ObjectPtr ptr)
pure 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!

Parameters
ptr[in] A pointer to the new object to point to.

Implemented in Safir::Dob::Typesystem::ObjectContainerImpl< T >, Safir::Dob::Typesystem::ObjectContainerImpl< ClassType >, Safir::Dob::Typesystem::ObjectContainerImpl< Entity >, Safir::Dob::Typesystem::ObjectContainerImpl< Safir::Dob::Typesystem::Object >, and Safir::Dob::Typesystem::ObjectContainerImpl< U >.

◆ SetPtr()

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

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.

Implemented in Safir::Dob::Typesystem::ObjectContainerImpl< T >, Safir::Dob::Typesystem::ObjectContainerImpl< ClassType >, Safir::Dob::Typesystem::ObjectContainerImpl< Entity >, Safir::Dob::Typesystem::ObjectContainerImpl< Safir::Dob::Typesystem::Object >, Safir::Dob::Typesystem::ObjectContainerImpl< U >, and Safir::Dob::Typesystem::ObjectContainerImpl< Object >.

Friends And Related Symbol Documentation

◆ Safir::Dob::Typesystem::Internal::BlobOperations

friend class Safir::Dob::Typesystem::Internal::BlobOperations
friend