CartoType API
Public Member Functions
CartoType::CArray< T > Class Template Reference

#include <cartotype_array.h>

Inheritance diagram for CartoType::CArray< T >:
CartoType::CArrayBase

List of all members.

Public Member Functions

 CArray (int32 aIncrement=0)
TResult Append (const T *aElement, int32 aCount)
TResult Append (const T &aElement)
TResult Insert (const T *aElement, int32 aIndex, int32 aCount)
TResult Insert (const T &aElement, int32 aIndex)
TResult Replace (int32 aIndex, int32 aOldCount, const T *aElement, int32 aNewCount)
void Delete (int32 aIndex, int32 aCount=1)
void Clear ()
void SetSizeToZero ()
TResult SetSize (int32 aSize)
int32 Count () const
T * Data ()
const T * Data () const
T & operator[] (int32 aIndex)
const T & operator[] (int32 aIndex) const
TResult Reserve (int32 aCount)
T * RemoveData ()
int32 MemoryUsed () const

Detailed Description

template<class T>
class CartoType::CArray< T >

A variable-size array of objects of type T. This class should be used for arrays of T-class objects - that is, objects that do not have a destructor and act like relatively simple types, and can be copied using a bitwise copy of their bytes.


Constructor & Destructor Documentation

template<class T>
CartoType::CArray< T >::CArray ( int32  aIncrement = 0) [inline]

Create an array with an increment specified by aIncrement. If aIncrement is zero, space for 8 elements is reserved when the first element is added, and after that, every time the size is exceeded the number of reserved elements is doubled.

The default behaviour is usually appropriate. However, if you specify a positive increment, the number of reserved elements is increased by that number when the size is exceeded. In both cases, the number of new elements reserved will be overridden when appending a larger number of elements all at once.


Member Function Documentation

template<class T>
TResult CartoType::CArray< T >::Append ( const T *  aElement,
int32  aCount 
) [inline]

Append aCount elements stored contiguously in the C++ array aElement.

template<class T>
TResult CartoType::CArray< T >::Append ( const T &  aElement) [inline]

Append a single element.

template<class T>
void CartoType::CArray< T >::Clear ( ) [inline]

Delete all the elements.

Reimplemented from CartoType::CArrayBase.

template<class T>
int32 CartoType::CArray< T >::Count ( ) const [inline]

Return the number of elements.

template<class T>
T* CartoType::CArray< T >::Data ( ) [inline]

Return a writable pointer to the underlying C++ array of elements.

template<class T>
const T* CartoType::CArray< T >::Data ( ) const [inline]

Return a read-only pointer to the underlying C++ array of elements.

template<class T>
void CartoType::CArray< T >::Delete ( int32  aIndex,
int32  aCount = 1 
) [inline]

Delete aCount elements, starting with aIndex.

Reimplemented from CartoType::CArrayBase.

template<class T>
TResult CartoType::CArray< T >::Insert ( const T *  aElement,
int32  aIndex,
int32  aCount 
) [inline]

Insert aCount elements before the element indexed by aIndex.

template<class T>
TResult CartoType::CArray< T >::Insert ( const T &  aElement,
int32  aIndex 
) [inline]

Insert a single element before the element indexed by aIndex.

template<class T>
int32 CartoType::CArray< T >::MemoryUsed ( ) const [inline]

Return the number of heap bytes used by the array.

template<class T>
T& CartoType::CArray< T >::operator[] ( int32  aIndex) [inline]

The writable array index operator, allowing the array to be treated like a C++ array.

template<class T>
const T& CartoType::CArray< T >::operator[] ( int32  aIndex) const [inline]

The constant array index operator, allowing the array to be treated like a C++ array.

template<class T>
T* CartoType::CArray< T >::RemoveData ( ) [inline]

Extract the underlying C++ array and take ownership of it.

template<class T>
TResult CartoType::CArray< T >::Replace ( int32  aIndex,
int32  aOldCount,
const T *  aElement,
int32  aNewCount 
) [inline]

Replace aOldCount elements starting at aIndex with aNewCount elements from aElement.

template<class T>
TResult CartoType::CArray< T >::Reserve ( int32  aCount) [inline]

Reserve space for at least aCount elements.

Reimplemented from CartoType::CArrayBase.

template<class T>
TResult CartoType::CArray< T >::SetSize ( int32  aSize) [inline]

Set the size of the array.

Reimplemented from CartoType::CArrayBase.

template<class T>
void CartoType::CArray< T >::SetSizeToZero ( ) [inline]

Set the size of the array to zero without discarding reserved memory.

Reimplemented from CartoType::CArrayBase.


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