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

STL container for arrays of DOB-containers. More...

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

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

Public Types

typedef Vector::iterator iterator
 
typedef Vector::const_iterator const_iterator
 
typedef Vector::reference reference
 
typedef Vector::const_reference const_reference
 

Public Member Functions

 ArrayContainer (const Int32 size)
 Constructor with size.
 
 ArrayContainer (const ArrayContainer &other)
 Copy Constructor.
 
ArrayContaineroperator= (const ArrayContainer &other)
 Copy Assignment operator.
 
Int32 size () const
 Get the size of the array.
 
reference operator[] (const Int32 index)
 Returns a reference to the vector element at a specified position.
 
const_reference operator[] (const Int32 index) const
 Returns a const reference to the vector element at a specified position.
 
bool IsChanged () const
 Check if any element has a change flag set on it.
 
void SetChanged (bool changed)
 Set the change flag on all elements in the array.
 

Detailed Description

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

STL container for arrays of DOB-containers.

This template class is used for arrays of containers in objects. The arrays cannot change size once they have been created. Apart from that they behave like a normal STL container.

This class exports the following from std::vector:

Types: iterator, const_iterator, reference const_reference;

Methods: begin(), end().

See your STL documentation for information on them

Note: This container is currently a random access container (based on std::vector). At some point in the future it may change to become a reversible container (based on a std::map). Do not assume that the [] operator is constant time.

Member Typedef Documentation

◆ const_iterator

template<class T >
typedef Vector::const_iterator Safir::Dob::Typesystem::ArrayContainer< T >::const_iterator

◆ const_reference

template<class T >
typedef Vector::const_reference Safir::Dob::Typesystem::ArrayContainer< T >::const_reference

◆ iterator

template<class T >
typedef Vector::iterator Safir::Dob::Typesystem::ArrayContainer< T >::iterator

◆ reference

template<class T >
typedef Vector::reference Safir::Dob::Typesystem::ArrayContainer< T >::reference

Constructor & Destructor Documentation

◆ ArrayContainer() [1/2]

template<class T >
Safir::Dob::Typesystem::ArrayContainer< T >::ArrayContainer ( const Int32 size)
explicit

Constructor with size.

Creates an array of the given size. Remember that once it has been created the size cannot be changed.

Parameters
size[in] - The desired size of the array. Must be > 0.
Exceptions
IllegalValueExceptionThe size argument is <= 0.

References __WFILE__, and Safir::Dob::Typesystem::ArrayContainer< T >::size().

Here is the call graph for this function:

◆ ArrayContainer() [2/2]

template<class T >
Safir::Dob::Typesystem::ArrayContainer< T >::ArrayContainer ( const ArrayContainer< T > & other)

Copy Constructor.

Creates a copy of an array

Parameters
other[in] - The array to create a copy of.

Member Function Documentation

◆ IsChanged()

template<class T >
bool Safir::Dob::Typesystem::ArrayContainer< T >::IsChanged ( ) const

Check if any element has a change flag set on it.

Note that if this array contains objects this call will be recursive.

Returns
true if any element has changed.

References Safir::Dob::Typesystem::IsChanged().

Here is the call graph for this function:

◆ operator=()

template<class T >
ArrayContainer & Safir::Dob::Typesystem::ArrayContainer< T >::operator= ( const ArrayContainer< T > & other)

Copy Assignment operator.

Copies an array into another array. The arrays must be of the same size.

Parameters
other[in] - The array to create a copy of.
Exceptions
SoftwareViolationExceptionThe arrays are not of the same size.

References __WFILE__, and Safir::Dob::Typesystem::ArrayContainer< T >::size().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T >
reference Safir::Dob::Typesystem::ArrayContainer< T >::operator[] ( const Int32 index)

Returns a reference to the vector element at a specified position.

Parameters
indexThe index of the element to get.
Returns
A reference to the element.
Exceptions
IllegalValueExceptionThe array index is outside the range of the array.

References __WFILE__.

◆ operator[]() [2/2]

template<class T >
const_reference Safir::Dob::Typesystem::ArrayContainer< T >::operator[] ( const Int32 index) const

Returns a const reference to the vector element at a specified position.

Parameters
indexThe index of the element to get.
Returns
A const reference to the element.
Exceptions
IllegalValueExceptionThe array index is outside the range of the array.

References __WFILE__.

◆ SetChanged()

template<class T >
void Safir::Dob::Typesystem::ArrayContainer< T >::SetChanged ( bool changed)

Set the change flag on all elements in the array.

Note that if this array contains objects this call will be recursive.

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

◆ size()

template<class T >
Int32 Safir::Dob::Typesystem::ArrayContainer< T >::size ( ) const

Get the size of the array.

This is a constant time operation.

Returns
the size of the array.

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

Here is the caller graph for this function: