Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::util::Array< T, SizeType, AllocatorType > Class Template Reference

A class that represents a dynamically-sized sequence of objects stored contiguously in memory. More...

#include <omArray.h>

Public Member Functions

 Array ()
 Create an empty array. This constructor does not allocate any memory. More...
 
 Array (SizeType arraySize)
 Create an array of the specified size with default-constructed elements. More...
 
 Array (SizeType arraySize, const T &prototype)
 Create an array of the specified size with elements created from the specified prototype. More...
 
 Array (T *newArray, SizeType arraySize)
 Create an array which uses the specified pointer to a block of memory. More...
 
 Array (const T *newArray, SizeType arraySize)
 Create an array with elements from the specified pointer, copying the data. More...
 
 Array (const Array &other)
 Create a deep copy of the specified array object. More...
 
 Array (const Array &other, SizeType number)
 Create a deep copy of the specified array object, using only the specified number of elements. More...
 
Arrayoperator= (const Array &other)
 Copy the contents from another array into this array, replacing the current contents. More...
 
 ~Array ()
 Destroy an array object and deallocate its internal array. More...
 
T * getPointer ()
 Convert this array to a pointer and return the result. More...
 
const T * getPointer () const
 Convert this array to a pointer and return the result, const version. More...
 
 operator T * ()
 Convert this array to a pointer. More...
 
 operator const T * () const
 Convert this array to a pointer, const version. More...
 
Bool operator== (const Array &array) const
 Compare this array to another array for equality. More...
 
Bool operator!= (const Array &array) const
 Compare this array to another array for inequality. More...
 
Array operator+ (const Array &other) const
 Concatenate the contents of this array with another array and return the resulting new array. More...
 
SizeType getSize () const
 Get the size of this array. More...
 
void setSize (SizeType newSize)
 Resize this array, copying as many elements from the old array to the new array as possible. More...
 
void setSize (SizeType newSize, const T &prototype)
 Resize this array, copying as many elements from the old array to the new array as possible. More...
 
void setAll (const T &prototype)
 Set all of the values in this array to the specified value. More...
 
Bool isNull () const
 Return whether or not this array object's internal array is NULL. More...
 
Bool isSet () const
 Return whether or not this array object's internal array is not NULL. More...
 

Detailed Description

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
class om::util::Array< T, SizeType, AllocatorType >

A class that represents a dynamically-sized sequence of objects stored contiguously in memory.

Constructor & Destructor Documentation

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( )
inline

Create an empty array. This constructor does not allocate any memory.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( SizeType  arraySize)
inlineexplicit

Create an array of the specified size with default-constructed elements.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( SizeType  arraySize,
const T &  prototype 
)
inlineexplicit

Create an array of the specified size with elements created from the specified prototype.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( T *  newArray,
SizeType  arraySize 
)
inlineexplicit

Create an array which uses the specified pointer to a block of memory.

After calling this constructor, the Array now owns the pointer and will automatically delete it when the array is destructed.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( const T *  newArray,
SizeType  arraySize 
)
inlineexplicit

Create an array with elements from the specified pointer, copying the data.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( const Array< T, SizeType, AllocatorType > &  other)
inline

Create a deep copy of the specified array object.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::Array ( const Array< T, SizeType, AllocatorType > &  other,
SizeType  number 
)
inline

Create a deep copy of the specified array object, using only the specified number of elements.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::~Array ( )
inline

Destroy an array object and deallocate its internal array.

Member Function Documentation

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
Array& om::util::Array< T, SizeType, AllocatorType >::operator= ( const Array< T, SizeType, AllocatorType > &  other)
inline

Copy the contents from another array into this array, replacing the current contents.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
T* om::util::Array< T, SizeType, AllocatorType >::getPointer ( )
inline

Convert this array to a pointer and return the result.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
const T* om::util::Array< T, SizeType, AllocatorType >::getPointer ( ) const
inline

Convert this array to a pointer and return the result, const version.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::operator T * ( )
inline

Convert this array to a pointer.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
om::util::Array< T, SizeType, AllocatorType >::operator const T * ( ) const
inline

Convert this array to a pointer, const version.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
Bool om::util::Array< T, SizeType, AllocatorType >::operator== ( const Array< T, SizeType, AllocatorType > &  array) const
inline

Compare this array to another array for equality.

If this array has the same size as the other array and has the same elements, the arrays are equal and TRUE is returned. Otherwise, the arrays are not equal and FALSE is returned.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
Bool om::util::Array< T, SizeType, AllocatorType >::operator!= ( const Array< T, SizeType, AllocatorType > &  array) const
inline

Compare this array to another array for inequality.

If this array has a different size than the other array or has different elements, the arrays are not equal and TRUE is returned. Otherwise, the arrays are equal and FALSE is returned.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
Array om::util::Array< T, SizeType, AllocatorType >::operator+ ( const Array< T, SizeType, AllocatorType > &  other) const
inline

Concatenate the contents of this array with another array and return the resulting new array.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
SizeType om::util::Array< T, SizeType, AllocatorType >::getSize ( ) const
inline

Get the size of this array.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
void om::util::Array< T, SizeType, AllocatorType >::setSize ( SizeType  newSize)
inline

Resize this array, copying as many elements from the old array to the new array as possible.

If there are new elements created at the end of the array, they are default constructed.

template<typename T, typename SizeType, typename AllocatorType >
void om::util::Array< T, SizeType, AllocatorType >::setSize ( SizeType  newSize,
const T &  prototype 
)

Resize this array, copying as many elements from the old array to the new array as possible.

If there are new elements created at the end of the array, they are initialize to the specified default value.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
void om::util::Array< T, SizeType, AllocatorType >::setAll ( const T &  prototype)
inline

Set all of the values in this array to the specified value.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
Bool om::util::Array< T, SizeType, AllocatorType >::isNull ( ) const
inline

Return whether or not this array object's internal array is NULL.

template<class T, typename SizeType = Size, typename AllocatorType = Allocator>
Bool om::util::Array< T, SizeType, AllocatorType >::isSet ( ) const
inline

Return whether or not this array object's internal array is not NULL.


The documentation for this class was generated from the following file: