Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::ValueContainer< T > Class Template Reference

Container for base types. More...

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

Inheritance diagram for Safir::Dob::Typesystem::ValueContainer< T >:
[legend]
Collaboration diagram for Safir::Dob::Typesystem::ValueContainer< T >:
[legend]

Public Types

typedef T ContainedType
 

Public Member Functions

constexpr ValueContainer ()
 Default constructor.
 
void SetVal (const T value)
 Set the value of the container.
 
GetVal () const
 Get the value of the container.
 
const T GetValOrDefault (const T &defaultVal) const
 Get the value of the container if the container has a value.
 
bool IsNull () const override
 Is the container set to null?
 
bool HasVal () const override
 Does the container have a value?
 
void SetNull () override
 Set the container to null.
 
void Copy (const ContainerBase &that) override
 Virtual assignment.
 
- 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 IsChanged () const
 Is the change flag set on the container?
 
virtual void SetChanged (const bool changed)
 Set the containers change flag.
 

Friends

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

Additional Inherited Members

- 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

template<class T>
class Safir::Dob::Typesystem::ValueContainer< T >

Container for base types.

This class holds a value of the template argument type and a null flag. The operations that modify the value update the null flag and the change flag (which is inherited from ContainerBase).

This container is intended for the simple types of the DOB typesystem. There should be no need to use this type in a definition, since all the relevant instances of this template are defined with typedefs (e.g. Int32Container, BooleanContainer, EntityIdContainer, etc).

Parameters
TThe type to contain.

Member Typedef Documentation

◆ ContainedType

template<class T>
typedef T Safir::Dob::Typesystem::ValueContainer< T >::ContainedType

Constructor & Destructor Documentation

◆ ValueContainer()

template<class T>
Safir::Dob::Typesystem::ValueContainer< T >::ValueContainer ( )
constexpr

Default constructor.

Creates a null and not changed container.

Member Function Documentation

◆ Copy()

template<class T>
void Safir::Dob::Typesystem::ValueContainer< T >::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.

◆ GetVal()

template<class T>
T Safir::Dob::Typesystem::ValueContainer< T >::GetVal ( ) const

Get the value of the container.

Returns
The value of the container.
Exceptions
NullExceptionThe container is null.

◆ GetValOrDefault()

template<class T>
const T Safir::Dob::Typesystem::ValueContainer< T >::GetValOrDefault ( const T & defaultVal) const

Get the value of the container if the container has a value.

If the container is null, the the supplied default value is returned.

Parameters
defaultVal[in] - Default value that is returned if the container is null.
Returns
The value of the container or the defaultValue if container is null.

◆ HasVal()

template<class T>
bool Safir::Dob::Typesystem::ValueContainer< T >::HasVal ( ) const
overridevirtual

Does the container have a value?

The opposite to IsNull.

Returns
True if the container has a value, False if the container is set to null.

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

◆ IsNull()

template<class T>
bool Safir::Dob::Typesystem::ValueContainer< T >::IsNull ( ) const
overridevirtual

Is the container set to null?

Returns
True if the container is set to null.

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

◆ SetNull()

template<class T>
void Safir::Dob::Typesystem::ValueContainer< T >::SetNull ( )
overridevirtual

Set the container to null.

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

◆ SetVal()

template<class T>
void Safir::Dob::Typesystem::ValueContainer< T >::SetVal ( const T value)

Set the value of the container.

Null and change flags are updated accordingly.

Parameters
value[in] - The new value.

Friends And Related Symbol Documentation

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

template<class T>
friend class Safir::Dob::Typesystem::Internal::BlobOperations
friend