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

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

#include <omShortArray.h>

Public Member Functions

 ShortArray ()
 Create an empty array. This constructor does not allocate any memory. More...
 
 ShortArray (SizeType arraySize)
 Create an array of the specified size with default-constructed elements. More...
 
 ShortArray (SizeType arraySize, const T &prototype)
 Create an array of the specified size with elements created from the specified prototype. More...
 
 ShortArray (T *newArray, SizeType arraySize)
 Create an array which uses the specified pointer to a block of memory. More...
 
 ShortArray (const T *newArray, SizeType arraySize)
 Create an array with elements from the specified pointer, copying the data. More...
 
 ShortArray (const ShortArray &other)
 Create a deep copy of the specified array object. More...
 
template<Size localCapacity2>
 ShortArray (const ShortArray< T, localCapacity2, SizeType > &other)
 Create a deep copy of the specified array object. More...
 
template<Size localCapacity2>
 ShortArray (const ShortArray< T, localCapacity2, SizeType > &other, SizeType number)
 Create a deep copy of the specified array object, using only the specified number of elements. More...
 
 ~ShortArray ()
 Destroy an array object and deallocate its internal array. More...
 
ShortArrayoperator= (const ShortArray &other)
 Copy the contents from another array into this array, replacing the current contents. More...
 
template<Size localCapacity2>
ShortArray< T, localCapacity, SizeType > & operator= (const ShortArray< T, localCapacity2, SizeType > &other)
 Copy the contents from another array into this array, replacing the current contents. 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...
 
template<Size localCapacity2>
Bool operator== (const ShortArray< T, localCapacity2, SizeType > &array) const
 Compare this array to another array for equality. More...
 
template<Size localCapacity2>
Bool operator!= (const ShortArray< T, localCapacity2, SizeType > &array) const
 Compare this array to another array for inequality. More...
 
template<Size localCapacity2>
ShortArray< T, localCapacity, SizeType > operator+ (const ShortArray< T, localCapacity2, SizeType > &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...
 

Detailed Description

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
class om::util::ShortArray< T, localCapacity, SizeType >

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

This class functions identically to the Array class, except that it has local storage for a small number of objects that are stored as part of the array object, eliminating an array allocation if the number of objects is small.

Constructor & Destructor Documentation

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( )
inline

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( SizeType  arraySize)
inlineexplicit

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( SizeType  arraySize,
const T &  prototype 
)
inlineexplicit

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( 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<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( const T *  newArray,
SizeType  arraySize 
)
inlineexplicit

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( const ShortArray< T, localCapacity, SizeType > &  other)
inline

Create a deep copy of the specified array object.

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
template<Size localCapacity2>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( const ShortArray< T, localCapacity2, SizeType > &  other)
inline

Create a deep copy of the specified array object.

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
template<Size localCapacity2>
om::util::ShortArray< T, localCapacity, SizeType >::ShortArray ( const ShortArray< T, localCapacity2, SizeType > &  other,
SizeType  number 
)
inline

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::~ShortArray ( )
inline

Destroy an array object and deallocate its internal array.

Member Function Documentation

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
ShortArray& om::util::ShortArray< T, localCapacity, SizeType >::operator= ( const ShortArray< T, localCapacity, SizeType > &  other)
inline

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
template<Size localCapacity2>
ShortArray<T,localCapacity,SizeType>& om::util::ShortArray< T, localCapacity, SizeType >::operator= ( const ShortArray< T, localCapacity2, SizeType > &  other)
inline

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
T* om::util::ShortArray< T, localCapacity, SizeType >::getPointer ( )
inline

Convert this array to a pointer and return the result.

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
const T* om::util::ShortArray< T, localCapacity, SizeType >::getPointer ( ) const
inline

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::operator T * ( )
inline

Convert this array to a pointer.

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
om::util::ShortArray< T, localCapacity, SizeType >::operator const T * ( ) const
inline

Convert this array to a pointer, const version.

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
template<Size localCapacity2>
Bool om::util::ShortArray< T, localCapacity, SizeType >::operator== ( const ShortArray< T, localCapacity2, SizeType > &  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<typename T, Size localCapacity = Size(4), typename SizeType = Size>
template<Size localCapacity2>
Bool om::util::ShortArray< T, localCapacity, SizeType >::operator!= ( const ShortArray< T, localCapacity2, SizeType > &  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<typename T, Size localCapacity = Size(4), typename SizeType = Size>
template<Size localCapacity2>
ShortArray<T,localCapacity,SizeType> om::util::ShortArray< T, localCapacity, SizeType >::operator+ ( const ShortArray< T, localCapacity2, SizeType > &  other) const
inline

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

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
SizeType om::util::ShortArray< T, localCapacity, SizeType >::getSize ( ) const
inline

Get the size of this array.

template<typename T, Size localCapacity = Size(4), typename SizeType = Size>
void om::util::ShortArray< T, localCapacity, SizeType >::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, Size localCapacity, typename SizeType>
void om::util::ShortArray< T, localCapacity, SizeType >::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<typename T, Size localCapacity = Size(4), typename SizeType = Size>
void om::util::ShortArray< T, localCapacity, SizeType >::setAll ( const T &  prototype)
inline

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


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