![]() |
Safir SDK Core
|
STL container for arrays of DOB-containers. More...
#include <Safir/Dob/Typesystem/ArrayContainer.h>
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. | |
ArrayContainer & | operator= (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. | |
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.
typedef Vector::const_iterator Safir::Dob::Typesystem::ArrayContainer< T >::const_iterator |
typedef Vector::const_reference Safir::Dob::Typesystem::ArrayContainer< T >::const_reference |
typedef Vector::iterator Safir::Dob::Typesystem::ArrayContainer< T >::iterator |
typedef Vector::reference Safir::Dob::Typesystem::ArrayContainer< T >::reference |
|
explicit |
Constructor with size.
Creates an array of the given size. Remember that once it has been created the size cannot be changed.
size | [in] - The desired size of the array. Must be > 0. |
IllegalValueException | The size argument is <= 0. |
References __WFILE__, and Safir::Dob::Typesystem::ArrayContainer< T >::size().
Safir::Dob::Typesystem::ArrayContainer< T >::ArrayContainer | ( | const ArrayContainer< T > & | other | ) |
Copy Constructor.
Creates a copy of an array
other | [in] - The array to create a copy of. |
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.
References Safir::Dob::Typesystem::IsChanged().
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.
other | [in] - The array to create a copy of. |
SoftwareViolationException | The arrays are not of the same size. |
References __WFILE__, and Safir::Dob::Typesystem::ArrayContainer< T >::size().
reference Safir::Dob::Typesystem::ArrayContainer< T >::operator[] | ( | const Int32 | index | ) |
Returns a reference to the vector element at a specified position.
index | The index of the element to get. |
IllegalValueException | The array index is outside the range of the array. |
References __WFILE__.
const_reference Safir::Dob::Typesystem::ArrayContainer< T >::operator[] | ( | const Int32 | index | ) | const |
Returns a const reference to the vector element at a specified position.
index | The index of the element to get. |
IllegalValueException | The array index is outside the range of the array. |
References __WFILE__.
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.
changed | [in] - The value to set the change flags to. |
Int32 Safir::Dob::Typesystem::ArrayContainer< T >::size | ( | ) | const |
Get the size of the array.
This is a constant time operation.
Referenced by Safir::Dob::Typesystem::ArrayContainer< T >::ArrayContainer(), and Safir::Dob::Typesystem::ArrayContainer< T >::operator=().