PikeAero::CArray< T > Class Template Reference

#include <carray.h>

Inheritance diagram for PikeAero::CArray< T >:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CArray< T >:

Collaboration graph
[legend]

Public Member Functions

CArray< T > & append (T data)
const T & at (CMachine::ubit32 index)
 CArray ()
virtual void clear ()
CMachine::ubit32 count ()
const T * data ()
bool isEmpty ()
bool isNull ()
virtual CMachine::ubit32 length ()
CArray< T > & resize (CMachine::ubit32 size)
CArray< T > & set (CMachine::ubit32 index, T data)
CMachine::ubit32 size ()
const T & take (CMachine::ubit32 index)
 ~CArray ()

Protected Attributes

T * mData
CMachine::ubit32 mSize

Detailed Description

template<class T>
class PikeAero::CArray< T >

Array template class
Author:
Michael Sharkey <mike@pikeaero.com>

Definition at line 31 of file carray.h.


Constructor & Destructor Documentation

template<class T >
PikeAero::CArray< T >::CArray (  )  [inline]

Definition at line 67 of file carray.h.

00068  : CObject()
00069  , mSize(0)
00070  , mData(NULL)
00071 {
00072 }

template<class T >
PikeAero::CArray< T >::~CArray (  )  [inline]

Definition at line 74 of file carray.h.

References PikeAero::CArray< T >::clear().

00075 {
00076     clear();
00077 }

Here is the call graph for this function:


Member Function Documentation

template<class T>
CArray< T > & PikeAero::CArray< T >::append ( data  )  [inline]

Definition at line 95 of file carray.h.

References PikeAero::CArray< T >::resize(), and PikeAero::CArray< T >::size().

Referenced by PikeAero::CString::explode().

00096 {
00097     CMachine::ubit32 t=size();
00098     return resize(size()+1).set(t,data);
00099 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
const T & PikeAero::CArray< T >::at ( CMachine::ubit32  index  )  [inline]

template<class T >
void PikeAero::CArray< T >::clear (  )  [inline, virtual]

Definition at line 79 of file carray.h.

References PikeAero::CMemHeap::free(), PikeAero::CArray< T >::mData, and PikeAero::CArray< T >::mSize.

Referenced by PikeAero::CArray< T >::~CArray().

00080 {
00081     if ( mData != NULL )
00082     {
00083         CMemHeap::free(mData);
00084         mData=NULL;
00085     }
00086     mSize=0;
00087 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
CMachine::ubit32 PikeAero::CArray< T >::count (  )  [inline]

template<class T >
const T * PikeAero::CArray< T >::data (  )  [inline]

Definition at line 134 of file carray.h.

References PikeAero::CArray< T >::mData.

00135 {
00136     return mData;
00137 }

template<class T >
bool PikeAero::CArray< T >::isEmpty (  )  [inline]

Definition at line 144 of file carray.h.

References PikeAero::CArray< T >::isNull(), and PikeAero::CArray< T >::length().

00145 {
00146     return isNull() || length()==0;
00147 }

Here is the call graph for this function:

template<class T >
bool PikeAero::CArray< T >::isNull (  )  [inline]

Definition at line 139 of file carray.h.

References PikeAero::CArray< T >::mData.

Referenced by PikeAero::CArray< T >::isEmpty().

00140 {
00141     return mData==NULL;
00142 }

Here is the caller graph for this function:

template<class T >
CMachine::ubit32 PikeAero::CArray< T >::length (  )  [inline, virtual]

Definition at line 129 of file carray.h.

References PikeAero::CArray< T >::mSize.

Referenced by PikeAero::CArray< T >::isEmpty().

00130 {
00131     return mSize;
00132 }

Here is the caller graph for this function:

template<class T >
CArray< T > & PikeAero::CArray< T >::resize ( CMachine::ubit32  size  )  [inline]

Definition at line 89 of file carray.h.

References PikeAero::CArray< T >::mData, PikeAero::CArray< T >::mSize, and PikeAero::CMemHeap::realloc().

Referenced by PikeAero::CArray< T >::append(), and PikeAero::CArray< T >::take().

00090 {
00091     mData = static_cast<T*>(CMemHeap::realloc(mData,(mSize=size)*sizeof(T)));
00092     return *this;
00093 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
CArray< T > & PikeAero::CArray< T >::set ( CMachine::ubit32  index,
data 
) [inline]

Definition at line 101 of file carray.h.

References PikeAero::CArray< T >::mData.

00102 {
00103     mData[index] = data;
00104     return *this;
00105 }

template<class T >
CMachine::ubit32 PikeAero::CArray< T >::size (  )  [inline]

Definition at line 124 of file carray.h.

References PikeAero::CArray< T >::mSize.

Referenced by PikeAero::CArray< T >::append(), PikeAero::CArray< D >::count(), PikeAero::CArrayInterpolator< S, D >::scaleHi(), and PikeAero::CArray< T >::take().

00125 {
00126     return mSize;
00127 }

Here is the caller graph for this function:

template<class T >
const T & PikeAero::CArray< T >::take ( CMachine::ubit32  index  )  [inline]

Definition at line 112 of file carray.h.

References PikeAero::CArray< T >::mData, PikeAero::CArray< T >::resize(), and PikeAero::CArray< T >::size().

00113 {
00114     const T& val = mData[index];
00115     for(CMachine::ubit32 i=index; i < size(); i++)
00116     {
00117         mData[i] = mData[i+1];
00118     }
00119     resize(size()-1);
00120     return val;
00121 }

Here is the call graph for this function:


Field Documentation

template<class T>
T* PikeAero::CArray< T >::mData [protected]

template<class T>
CMachine::ubit32 PikeAero::CArray< T >::mSize [protected]


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

Generated on Sun Oct 25 13:59:42 2009 for stingray3 by  doxygen 1.5.8