Exponent::Collections::TCollection< TypeName > Class Template Reference

List of all members.

Detailed Description

template<class TypeName>
class Exponent::Collections::TCollection< TypeName >

Template'd array of elements.

Stores an intrnal array of objects. For this to work properly, any objects must
have overloaded assignment operators

Date:
23/01/2006
Author:
Paul Chana
Version:
1.0.0 Initial version

1.0.1 Added copyBuffer function

Note:
All contents of this source code are copyright 2005 Exp Digital Uk.
This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
Certain sections of this code may come from other sources. They are credited where applicable.
If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk
Id
TCollection.hpp,v 1.9 2007/02/08 21:06:44 paul Exp

Definition at line 36 of file TCollection.hpp.

Public Member Functions

Protected Member Functions

Protected Attributes


Constructor & Destructor Documentation

template<class TypeName>
Exponent::Collections::TCollection< TypeName >::TCollection ( const long  size  ) 

Construction

Parameters:
size The size of the array

template<class TypeName>
Exponent::Collections::TCollection< TypeName >::TCollection ( const TCollection< TypeName > &  other  ) 

Copy construction

Parameters:
other The aray to copy

template<class TypeName>
Exponent::Collections::TCollection< TypeName >::TCollection (  ) 

Construction

template<class TypeName>
Exponent::Collections::TCollection< TypeName >::~TCollection (  ) 

Destruction


Member Function Documentation

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::addElementAtIndex ( const TypeName &  value,
const long  index 
)

Set the value of an element

Parameters:
value The value to give the element
index The index of the element to set

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::clearArray (  ) 

Clear the array

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::contract ( const long  contractBy  ) 

Contact the array (removes the number of entries starrting at the end

Parameters:
contractBy The amount ot shrink the array by

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::copyBuffer ( const TypeName *  buffer,
const long  size 
)

Copy another buffer

Parameters:
buffer The buffer to copy
size The size of the buffer

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::copyElements ( TypeName *  buffer,
const long  startIndex,
const long  size 
) const

Copy a set of elements

Parameters:
buffer The buffer to copy the values in to
startIndex The start index to copy from
size The size of the buffer being passed in

template<class TypeName>
TypeName Exponent::Collections::TCollection< TypeName >::elementAtIndex ( const long  index  )  const

Get the element at a specific index

Parameters:
index The index of the element
Return values:
TypeName The value

template<class TypeName>
TypeName* Exponent::Collections::TCollection< TypeName >::elementPointerAtIndex ( const long  index  ) 

Get a pointer to the element at a specific index

Parameters:
index The index of the element
Return values:
TypeName* The object or null on error

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::expand ( const long  expandBy  ) 

Expand the array (adds extra space at the end of the array

Parameters:
expandBy The amount of extra space to add

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::freePointers (  )  [protected]

Free pointers -> deleteds (but not allways) all pointers

template<class TypeName>
long Exponent::Collections::TCollection< TypeName >::getArraySize (  )  const

Get the size of the array

Return values:
long The size of the array

Referenced by Exponent::MathTools::TRandomNumberGenerator< TypeName >::getNewRandomArray().

template<class TypeName>
long Exponent::Collections::TCollection< TypeName >::getIndexOfObject ( const TypeName &  object  ) 

Get the index of an object

Parameters:
object The object to find
Return values:
long The index of the pointer or TPOINTERCOLLECTION_FAILED_TO_FIND_POINTER on error
See also:
TPointerCollection
Note:
Does a forward find for the first equal object. Uses overloaded equality operator

template<class TypeName>
const TypeName* Exponent::Collections::TCollection< TypeName >::getInternalBuffer (  )  const [inline]

Get internal buffer

Return values:
const TypeName * The internal buffer

Definition at line 206 of file TCollection.hpp.

References Exponent::Collections::TCollection< TypeName >::m_array.

template<class TypeName>
TypeName* Exponent::Collections::TCollection< TypeName >::getMutableInternalBuffer (  )  [inline]

Get the internal buffer

Return values:
const TypeName * The internal buffer

Definition at line 212 of file TCollection.hpp.

References Exponent::Collections::TCollection< TypeName >::m_array.

Referenced by Exponent::MathTools::TRandomNumberGenerator< TypeName >::getNewRandomArray().

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::initialise ( const long  size  ) 

Initialise the unit

Parameters:
size The size you want the array to be
Note:
This function deletes all objects in the array

template<class TypeName>
bool Exponent::Collections::TCollection< TypeName >::isObjectInArray ( const TypeName &  object  ) 

Is pointer in array

Parameters:
object The object to look for
Return values:
bool True if this object is stored in the array, false otherwise
See also:
TPointerCollection
Note:
Does a forward find for the first equal object. Uses overloaded equality operator

template<class TypeName>
TCollection& Exponent::Collections::TCollection< TypeName >::operator= ( const TypeName &  element  ) 

Set all elements to

Parameters:
element The element to set all to
Return values:
TVectory& A reference to this

template<class TypeName>
TCollection& Exponent::Collections::TCollection< TypeName >::operator= ( const TCollection< TypeName > &  other  ) 

Assignment operator

Parameters:
other The vector to copy
Return values:
TVector& A reference to this

template<class TypeName>
TypeName* Exponent::Collections::TCollection< TypeName >::operator[] ( const long  index  ) 

Get the element at a specific index

Parameters:
index The index of the item
Return values:
TypeName* The object or null on error

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::setAllElementsTo ( const TypeName &  value  ) 

Set to a specific value

Parameters:
value The value to set all the elements to

template<class TypeName>
void Exponent::Collections::TCollection< TypeName >::swapIndexes ( const long  index1,
const long  index2 
)

Swap two pointers

Parameters:
index1 The index of the first pointer
index2 The index of the second pointer


Member Data Documentation

template<class TypeName>
TypeName* Exponent::Collections::TCollection< TypeName >::m_array [protected]

The internal array

Definition at line 227 of file TCollection.hpp.

Referenced by Exponent::Collections::TCollection< TypeName >::getInternalBuffer(), and Exponent::Collections::TCollection< TypeName >::getMutableInternalBuffer().

template<class TypeName>
long Exponent::Collections::TCollection< TypeName >::m_arraySize [protected]

The size of the array

Definition at line 228 of file TCollection.hpp.


Infinity API - Exponent::Collections::TCollection< TypeName > Class Template Reference generated on 7 Mar 2007