KBaseArray Class Reference

Inherited by KArrayTemplate, KArrayTemplate< AccumulatorEntry * >, KArrayTemplate< int >, KArrayTemplate< KArrayTemplate< KFbxWeightedMapping::KElement > * >, KArrayTemplate< KFbxDataType >, KArrayTemplate< KFbxGenericNode * >, KArrayTemplate< KFbxNode * >, KArrayTemplate< KFbxSurfaceMaterial * >, KArrayTemplate< KFbxTexture * >, KArrayTemplate< KFbxUserNotification::AESequence * >, KArrayTemplate< KFbxUserParamEntry * >, KArrayTemplate< KFbxVideo * >, KArrayTemplate< KNumberRenamingStrategy::NameCell * >, KArrayTemplate< kOffset >, KArrayTemplate< KString * >, KArrayTemplate< KStringListItem * >, and KArrayTemplate< Type * >.

Inheritance diagram for KBaseArray:

Inheritance graph
List of all members.

Detailed Description

Definition at line 115 of file karrayul.h.

Public Member Functions

int GetCount () const
 Get number of pointers in the array.
void Clear ()
 Remove all pointers without deleting the associated objects.
void Empty ()
 Fast empty, set object count to zero but don't free any memory.
int Reserve (int pCapacity)
 Set array capacity to contain at least the specified number of elements without reallocating.
void SetCount (int pCount)
 Force the array of elements to a given size.

Protected Member Functions

 KBaseArray (int pItemPerBlock, int pItemSize)
 Constructor.
 ~KBaseArray ()
 Destructor.
int InsertAt (int pIndex, void *pItem)
 Insert an item at the given position.
void * GetAt (int pIndex)
 Get the item at the given position.
void RemoveAt (int pIndex)
 Removes the item at the given position.
bool ValidateIndex (int pIndex) const
 Check that the given position is inside the array boundaries.

Protected Attributes

int mArrayCount
int mBlockCount
int mItemPerBlock
int mItemSize


Constructor & Destructor Documentation

KBaseArray ( int  pItemPerBlock,
int  pItemSize 
) [protected]

Constructor.

Parameters:
pItemPerBlock Number of pointers per allocated block.
pItemSize Size of one item of the array.

~KBaseArray (  )  [protected]

Destructor.


Member Function Documentation

int InsertAt ( int  pIndex,
void *  pItem 
) [protected]

Insert an item at the given position.

Parameters:
pIndex Position where to insert the item.
pItem Pointer to the item to be inserted.
Remarks:
if pIndex is greater than the number of items already in the array, the item will be appended at the end.
Returns:
The actual position where the item as been inserted.

Referenced by KArrayTemplate< KString * >::InsertAt().

void* GetAt ( int  pIndex  )  [inline, protected]

Get the item at the given position.

Parameters:
pIndex The position of the item to access.
Returns:
Pointer to the item.
Remarks:
This method assumes that the passed inded is in the valid range of the array. No checks are made.

Definition at line 147 of file karrayul.h.

void RemoveAt ( int  pIndex  )  [protected]

bool ValidateIndex ( int  pIndex  )  const [protected]

Check that the given position is inside the array boundaries.

Parameters:
pIndex Index value to validate.
Returns:
true if the index value is within the array boundaries. false otherwise.

Referenced by KArrayTemplate< KString * >::GetAt(), KArrayTemplate< KString * >::operator[](), and KArrayTemplate< KString * >::SetAt().

int GetCount (  )  const [inline]

void Clear (  ) 

Remove all pointers without deleting the associated objects.

Referenced by KStringListTemplate< KStringListItem >::Clear(), and KArrayTemplate< KString * >::operator=().

void Empty (  ) 

Fast empty, set object count to zero but don't free any memory.

int Reserve ( int  pCapacity  ) 

Set array capacity to contain at least the specified number of elements without reallocating.

Parameters:
pCapacity Number of items that can be stored in the array before reallocating the memory.
Returns:
The number of available slots in the array.
Remarks:
If capacity is lower than arrayCount, arrayCount is lowered to capacity.

void SetCount ( int  pCount  ) 

Force the array of elements to a given size.

Remarks:
If the array is upsized, the memory allocated is set to 0 and no constructor is called. Thus, this function is not appropriate for types of elements requiring initialization.