
Public Types | |
| typedef T | TTemplateType |
| typedef T * | TValueType |
| The template type on which the array is based. | |
| typedef TMCPtrIterator< T, TMCPtrArray< T > > | iterator |
| typedef TMCConstPtrIterator < T, TMCPtrArray< T > > | const_iterator |
Public Member Functions | |
| TMCPtrArray (void) | |
| A type that represents the data type stored in the array. | |
| TMCPtrArray (uint32 initialCount, boolean initialZeroMem) | |
| TMCPtrArray (uint32 initialCount, uint32 initialSpace, uint32 initialGrowSize, boolean initialZeroMem) | |
| TMCPtrArray (const TMCPtrArray< T > &inFromArray) | |
| TMCPtrArray (const TMCCountedPtrArray< T > &inFromCountedPtrArray) | |
| TMCPtrArray< T > & | operator= (const TMCCountedPtrArray< T > &fromCountedPtrArray) |
| TMCPtrArray (T **const &baseAddress, boolean inAquireMemory, uint32 elemCount, uint32 elemSpace) | |
| TMCPtrArray (TMCPtrArray< T > &array, uint32 elemStart, uint32 elemCount) | |
| ~TMCPtrArray (void) | |
| void | DeleteAndRemoveElements (uint32 startIndex, uint32 deleteCount) |
| void | DeleteAndRemoveAll () |
| TMCPtrArray< T > & | operator= (const TMCPtrArray< T > &fromArray) |
| template<class TArray2> | |
| void | QueryArray (const MCIID &iid, TArray2 &outArray) const |
| Fills outArray. | |
| void | ArrayFree (void) |
| boolean | IsValid (void) const |
| int8 * | BaseAddress (void) |
| const int8 * | BaseAddress (void) const |
| uint32 | GetElemSize (void) const |
| uint32 | GetGrowSize (void) const |
| uint32 | GetElemSpace (void) const |
| uint32 | GetElemCount (void) const |
| boolean | GetZeroMem (void) const |
| boolean | ExternalMemory () |
| boolean | GetSmartGrow (void) const |
| T ** | ArrayData (void) |
| T **const | ArrayData (void) const |
| void | SetZeroMem (boolean z) |
| void | SetValid (boolean valid) |
| void | SetGrowSize (uint32 g) |
| void | SetSmartGrow () |
| boolean | SetElemSpace (uint32 n) |
| boolean | SetElemCount (uint32 n) |
| boolean | AddElemCount (uint32 n) |
| const_iterator | Begin (void) const |
| iterator | Begin (void) |
| const_iterator | End (void) const |
| iterator | End (void) |
| T *& | FirstElem (void) |
| const T *const | FirstElem (void) const |
| T *& | LastElem (void) |
| const T *const | LastElem (void) const |
| void | Erase (const iterator &elementToErase) |
| void | Erase (const iterator &start, const iterator &end) |
| boolean | CopyElems (const TMCPtrArray< T > &fromArray, uint32 startIndex, uint32 numItems, uint32 insertAtIndex) |
| boolean | Append (const TMCPtrArray< T > &fromArray) |
| void | FillWithValue (const T *inValue, uint32 inStart=kBeginIndex, uint32 inLength=kUnusedIndex) |
| void | Swap (TMCPtrArray< T > &fromArray) |
| T ** | Pointer (uint32 i) |
| T ** | Pointer (uint32 i) const |
| T *& | operator[] (uint32 i) |
| T *const & | operator[] (uint32 i) const |
| void | SetElem (uint32 index, const T *data) |
| void | GetElem (uint32 index, T *&data) |
| void | GetElem (uint32 index, const T *&data) const |
| boolean | AddElem (const T *data) |
| boolean | InsertElem (uint32 index, const T *data) |
| void | RemoveElem (uint32 index, uint32 count) |
| void | RemoveElem (T *elemToRemove) |
| uint32 | FindElem (const T *item) const |
| boolean | CompactArray (void) |
Protected Member Functions | |
| boolean | ArrayAlloc (uint32 initialCount, uint32 initialSpace, uint32 initialGrowSize, boolean initialZeroMem) |
| boolean | ArrayAllocFromBuffer (T **baseAddress, boolean inAquireMemory, uint32 elemCount, uint32 elemSpace) |
| void | UpdateDataPointer (void) |
| void | ZeroInternals (void) |
Protected Attributes | |
| uint32 | fElemCount |
| The number of elements in use. | |
| uint32 | fElemSpace |
| The number of elements allocated (unconstructed). | |
| uint32 | fArrayFlags |
| Flags that control the behavior of the array. | |
| T ** | fArrayData |
| The memory block used by the array. | |
Indexes to access the Array classes are ZERO based (array[0] gives you the first element)
Arrays grows dynamically as you add elements. For better efficiency, preallocate the number of elements you'll need (or use an estimation of the space if possible).
In eSmartGrow mode (the default), the size of the extra space added when the array is reallocated (the grow size) depends on the number of elements already in the array. Otherwise, a constant grow size is used.
Other array classes are: TMCArray, TMCCountedPtrArray, TMCClassArray and TMCExtensibleArray.
| typedef T TMCPtrArray< T >::TTemplateType |
| typedef T* TMCPtrArray< T >::TValueType |
The template type on which the array is based.
| typedef TMCPtrIterator<T, TMCPtrArray<T> > TMCPtrArray< T >::iterator |
Declare iterator types for this array
| typedef TMCConstPtrIterator<T, TMCPtrArray<T> > TMCPtrArray< T >::const_iterator |
| TMCPtrArray< T >::TMCPtrArray | ( | void | ) | [inline] |
A type that represents the data type stored in the array.
Creates an empty array
| TMCPtrArray< T >::TMCPtrArray | ( | uint32 | initialCount, | |
| boolean | initialZeroMem | |||
| ) | [inline] |
Constructs an array with a certain number of elements already accessible
| initialCount | initial number of array elements. | |
| initialZeroMem | Zero the memory allocated for array storage ? |
| TMCPtrArray< T >::TMCPtrArray | ( | uint32 | initialCount, | |
| uint32 | initialSpace, | |||
| uint32 | initialGrowSize, | |||
| boolean | initialZeroMem | |||
| ) | [inline] |
Constructs an array with a certain number of elements already accessible, and/or some extra space to extend the array without reallocating it.
| initialCount | Initial number of array elements. | |
| initialSpace | Pre-allocate space for this many elements (must be bigger than initialCount). | |
| initialGrowSize | How many elements to grow the array when we grow past the end | |
| initialZeroMem | Zero the memory allocated for array storage ? |
| TMCPtrArray< T >::TMCPtrArray | ( | const TMCPtrArray< T > & | inFromArray | ) | [inline] |
Copy constructor: Construct an array from an existing array.
| TMCPtrArray< T >::TMCPtrArray | ( | const TMCCountedPtrArray< T > & | inFromCountedPtrArray | ) | [inline] |
Copy constructor: Construct an array from an existing array.
| TMCPtrArray< T >::TMCPtrArray | ( | T **const & | baseAddress, | |
| boolean | inAquireMemory, | |||
| uint32 | elemCount, | |||
| uint32 | elemSpace | |||
| ) | [inline] |
Constructs an array from existing memory.
| baseAddress | External memory to use for this array. | |
| inAquireMemory | Should we take possession this memory. | |
| elemCount | The number of array elements in use in that memory. | |
| elemSpace | The number of array elements that can be used in that memory. |
| TMCPtrArray< T >::TMCPtrArray | ( | TMCPtrArray< T > & | array, | |
| uint32 | elemStart, | |||
| uint32 | elemCount | |||
| ) | [inline] |
Constructs an alias to an existing array.
| array | Alias elements from this array. | |
| elemStart | Start alias here. | |
| elemCount | Alias this many elements. |
| TMCPtrArray< T >::~TMCPtrArray | ( | void | ) | [inline] |
| TMCPtrArray< T > & TMCPtrArray< T >::operator= | ( | const TMCCountedPtrArray< T > & | fromCountedPtrArray | ) | [inline] |
operator=: Assignment operator copies all the pointers from one array to another.
| void TMCPtrArray< T >::DeleteAndRemoveElements | ( | uint32 | startIndex, | |
| uint32 | deleteCount | |||
| ) | [inline] |
Deletes some of the objects referenced by the array and then removes them from the array.
| startIndex | index of the first elem to delete and remove | |
| deleteCount | number of elements to delete and remove |
| void TMCPtrArray< T >::DeleteAndRemoveAll | ( | ) | [inline] |
Deletes all the objects referenced by the array and then removes them from the array.
| TMCPtrArray< T > & TMCPtrArray< T >::operator= | ( | const TMCPtrArray< T > & | fromArray | ) | [inline] |
operator=: Assignment operator copies all the pointers from one array to another.
| void TMCPtrArray< T >::QueryArray | ( | const MCIID & | iid, | |
| TArray2 & | outArray | |||
| ) | const [inline] |
Fills outArray.
| boolean TMCPtrArray< T >::ArrayAlloc | ( | uint32 | initialCount, | |
| uint32 | initialSpace, | |||
| uint32 | initialGrowSize, | |||
| boolean | initialZeroMem | |||
| ) | [inline, protected] |
!!! DO NOT CALL THIS !!!
| boolean TMCPtrArray< T >::ArrayAllocFromBuffer | ( | T ** | baseAddress, | |
| boolean | inAquireMemory, | |||
| uint32 | elemCount, | |||
| uint32 | elemSpace | |||
| ) | [inline, protected] |
!!! DO NOT CALL THIS !!!
| void TMCPtrArray< T >::ArrayFree | ( | void | ) | [inline] |
Frees all the memory held by this array (unless it uses external memory). And sets the element count to 0.
| boolean TMCPtrArray< T >::IsValid | ( | void | ) | const [inline] |
IsValid(): Check to see if the class is valid.
| int8* TMCPtrArray< T >::BaseAddress | ( | void | ) | [inline] |
Returns the address at which the elements of the array begin
| const int8* TMCPtrArray< T >::BaseAddress | ( | void | ) | const [inline] |
Returns the address at which the elements of the array begin
| uint32 TMCPtrArray< T >::GetElemSize | ( | void | ) | const [inline] |
Returns the size of one element (sizeof(T*))
| uint32 TMCPtrArray< T >::GetGrowSize | ( | void | ) | const [inline] |
Returns the size by which the array grows
| uint32 TMCPtrArray< T >::GetElemSpace | ( | void | ) | const [inline] |
Returns the number of elements that can be stored in the array (before the next reallocation)
| uint32 TMCPtrArray< T >::GetElemCount | ( | void | ) | const [inline] |
Returns the actual number of (valid) elements in the array. Those elements can be accessed with the operator []
| boolean TMCPtrArray< T >::GetZeroMem | ( | void | ) | const [inline] |
Returns true if the newly allocated memory should be initialized with zero
| boolean TMCPtrArray< T >::ExternalMemory | ( | ) | [inline] |
Returns true if the array doesn't own its memory
| boolean TMCPtrArray< T >::GetSmartGrow | ( | void | ) | const [inline] |
Returns true if the grow size is dynamic
| T** TMCPtrArray< T >::ArrayData | ( | void | ) | [inline] |
Returns a pointer to the first element
| T** const TMCPtrArray< T >::ArrayData | ( | void | ) | const [inline] |
Returns a pointer to the first element
| void TMCPtrArray< T >::SetZeroMem | ( | boolean | z | ) | [inline] |
Sets whether the newly allocated memory should be initialized with zero
| void TMCPtrArray< T >::SetValid | ( | boolean | valid | ) | [inline] |
Sets the valid flag to true
| void TMCPtrArray< T >::SetGrowSize | ( | uint32 | g | ) | [inline] |
Sets the growSize (and sets the eSmartGrow flag to false)
| void TMCPtrArray< T >::SetSmartGrow | ( | ) | [inline] |
Sets the eSmartGrow flag and computes the maximum grow size (in elements count)
| boolean TMCPtrArray< T >::SetElemSpace | ( | uint32 | n | ) | [inline] |
Set the number of elements to have memory allocated for.
| boolean TMCPtrArray< T >::SetElemCount | ( | uint32 | n | ) | [inline] |
Set the number of elements in the array.
| boolean TMCPtrArray< T >::AddElemCount | ( | uint32 | n | ) | [inline] |
Add the passed in number of elemens to the array.
| const_iterator TMCPtrArray< T >::Begin | ( | void | ) | const [inline] |
Returns an iterator initialized to the begining of the array.
| iterator TMCPtrArray< T >::Begin | ( | void | ) | [inline] |
Returns an iterator initialized to the begining of the array.
| const_iterator TMCPtrArray< T >::End | ( | void | ) | const [inline] |
Returns an iterator initialized to the end of the array.
| iterator TMCPtrArray< T >::End | ( | void | ) | [inline] |
Returns an iterator initialized to the end of the array.
| T*& TMCPtrArray< T >::FirstElem | ( | void | ) | [inline] |
Returns a reference to the first element in the array.
| const T* const TMCPtrArray< T >::FirstElem | ( | void | ) | const [inline] |
Returns a reference to the first element in the array.
| T*& TMCPtrArray< T >::LastElem | ( | void | ) | [inline] |
Returns a reference to the last element in the array.
| const T* const TMCPtrArray< T >::LastElem | ( | void | ) | const [inline] |
Returns a reference to the last element in the array.
| void TMCPtrArray< T >::Erase | ( | const iterator & | elementToErase | ) | [inline] |
Erases a single element in the array that is referenced by the iterator.
| void TMCPtrArray< T >::Erase | ( | const iterator & | start, | |
| const iterator & | end | |||
| ) | [inline] |
Erases a range of elements in the array from the startIterator to the endIterator.
| boolean TMCPtrArray< T >::CopyElems | ( | const TMCPtrArray< T > & | fromArray, | |
| uint32 | startIndex, | |||
| uint32 | numItems, | |||
| uint32 | insertAtIndex | |||
| ) | [inline] |
Copy elements from one array to another.
| boolean TMCPtrArray< T >::Append | ( | const TMCPtrArray< T > & | fromArray | ) | [inline] |
Append one array on to the end of another.
| void TMCPtrArray< T >::FillWithValue | ( | const T * | inValue, | |
| uint32 | inStart = kBeginIndex, |
|||
| uint32 | inLength = kUnusedIndex | |||
| ) | [inline] |
Fill an array range with the value passed in.
| void TMCPtrArray< T >::Swap | ( | TMCPtrArray< T > & | fromArray | ) | [inline] |
Swaps the contents of two arrays.
| T** TMCPtrArray< T >::Pointer | ( | uint32 | i | ) | [inline] |
Returns a pointer to the data at the passed in index.
| T** TMCPtrArray< T >::Pointer | ( | uint32 | i | ) | const [inline] |
Returns a pointer to the data at the passed in index.
| T*& TMCPtrArray< T >::operator[] | ( | uint32 | i | ) | [inline] |
Returns a reference to the data at the passed in index.
| T* const& TMCPtrArray< T >::operator[] | ( | uint32 | i | ) | const [inline] |
Returns a reference to the data at the passed in index.
| void TMCPtrArray< T >::SetElem | ( | uint32 | index, | |
| const T * | data | |||
| ) | [inline] |
Set the contents of array index to the passed in data reference.
| void TMCPtrArray< T >::GetElem | ( | uint32 | index, | |
| T *& | data | |||
| ) | [inline] |
Get the contents of array index into the passed in data reference.
| void TMCPtrArray< T >::GetElem | ( | uint32 | index, | |
| const T *& | data | |||
| ) | const [inline] |
Get the contents of array index into the passed in data reference.
| boolean TMCPtrArray< T >::AddElem | ( | const T * | data | ) | [inline] |
Add an element to the end of the array and assign it the data reference that is passed in.
| boolean TMCPtrArray< T >::InsertElem | ( | uint32 | index, | |
| const T * | data | |||
| ) | [inline] |
Insert one element into the array and assign the resulting item(s) the data data reference that is passed in.
| void TMCPtrArray< T >::RemoveElem | ( | uint32 | index, | |
| uint32 | count | |||
| ) | [inline] |
Removes one or more elements from the array starting from the passed in index.
| void TMCPtrArray< T >::RemoveElem | ( | T * | elemToRemove | ) | [inline] |
Remove one instance of elemToRemove if it exists in the array.
| uint32 TMCPtrArray< T >::FindElem | ( | const T * | item | ) | const [inline] |
Finds the index in this array of the given element
| item | the element to search for |
| boolean TMCPtrArray< T >::CompactArray | ( | void | ) | [inline] |
Gets rid of any space that has been allocated to the array and isn't being used.
| void TMCPtrArray< T >::UpdateDataPointer | ( | void | ) | [inline, protected] |
| void TMCPtrArray< T >::ZeroInternals | ( | void | ) | [inline, protected] |
uint32 TMCPtrArray< T >::fElemCount [protected] |
The number of elements in use.
uint32 TMCPtrArray< T >::fElemSpace [protected] |
The number of elements allocated (unconstructed).
uint32 TMCPtrArray< T >::fArrayFlags [protected] |
Flags that control the behavior of the array.
T** TMCPtrArray< T >::fArrayData [protected] |
The memory block used by the array.
1.5.3