This reference page is linked to from the following overview topics: List of Python FBX classes.
Class for array of elements such as pointers and plain old data structures.
This class will not call constructor and destructor for elements.
ExportScene03/main.cxx, ViewScene/InitScene.cxx, ViewScene/InitScene.h, and ViewScene/main.cxx.
Definition at line 839 of file karrayul.h.
#include <karrayul.h>

Public Member Functions |
|
| KArrayTemplate () | |
| Constructor. |
|
| KArrayTemplate (const KArrayTemplate &pArrayTemplate) | |
| Copy constructor. |
|
| ~KArrayTemplate () | |
| Destructor. The destructor of elements will
not be called. |
|
| int | InsertAt (int pIndex, Type pItem) |
| Insert a element. |
|
| Type | RemoveAt (int pIndex) |
| Remove a element in the array. |
|
| Type | RemoveLast () |
| Remove the last element in the array.
|
|
| bool | RemoveIt (Type pItem) |
| Remove first matching element in the array.
|
|
| Type & | operator[] (int pIndex) const |
| Returns a reference to the element at given
position in the array. |
|
| void | SetAt (int pIndex, Type pItem) |
| Set the element at given position in the
array. |
|
| void | SetLast (Type pItem) |
| Set the value of the last element. |
|
| Type | GetAt (int pIndex) const |
| Returns the value of the element at given
position in the array. |
|
| Type | GetFirst () const |
| Get the first element. |
|
| Type | GetLast () const |
| Get the last element. |
|
| int | Find (Type pItem) const |
| Find first matching element. |
|
| int | FindAfter (int pAfterIndex, Type pItem) const |
| Find first matching element after given
index. |
|
| int | FindBefore (int pBeforeIndex, Type pItem) const |
| Find first matching pointer before given
index. |
|
| int | Add (Type pItem) |
| Append an element at the end of the array.
|
|
| int | AddUnique (Type pItem) |
| Add Element at the end of array if not
present. |
|
| void | AddMultiple (kUInt pItemCount) |
| Add multiple elements at the end of array,
use SetAt or GetArray to set the value of the new elements.
|
|
| void | AddArray (const KArrayTemplate< Type > &pArray) |
| Append another array at the end of this
array. |
|
| void | AddArrayNoDuplicate (const KArrayTemplate< Type > &pArray) |
| Append the elements of another array at the
end of this array if they are not present. |
|
| void | RemoveArray (const KArrayTemplate< Type > &pArray) |
| Remove the elements of another array from
this array is they are present. |
|
| Type * | GetArray () const |
| Get pointer to internal array of elements.
|
|
| KArrayTemplate< Type > & | operator= (const KArrayTemplate< Type > &pArrayTemplate) |
| Copy array of elements. |
|
| operator Type * () | |
| Cast operator. |
|
| KArrayTemplate | ( | ) | [inline] |
| KArrayTemplate | ( | const KArrayTemplate< Type > & | pArrayTemplate | ) | [inline] |
Copy constructor.
Definition at line 864 of file karrayul.h.
: ParentClass ()
{
*this = pArrayTemplate;
}
| ~KArrayTemplate | ( | ) | [inline] |
Destructor. The destructor of elements will not be called.
Definition at line 871 of file karrayul.h.
{}
| int InsertAt | ( | int | pIndex, |
| Type | pItem | ||
| ) | [inline] |
Insert a element.
| pIndex | Position where to insert the pointer. |
| pItem | Item to insert. |
Definition at line 879 of file karrayul.h.
{
return ParentClass::InsertAt( pIndex,&pItem );
}
| Type RemoveAt | ( | int | pIndex | ) | [inline] |
Remove a element in the array.
| pIndex | Position of the item to remove. |
Reimplemented from KBaseArrayFast< sizeof(Type) >.
Definition at line 889 of file karrayul.h.
{
Type tmpItem = GetAt(pIndex);
ParentClass::RemoveAt( pIndex );
return tmpItem;
}
| Type RemoveLast | ( | ) | [inline] |
Remove the last element in the array.
Definition at line 900 of file karrayul.h.
{
return RemoveAt(ParentClass::GetArrayCount()-1);
}
| bool RemoveIt | ( | Type | pItem | ) | [inline] |
Remove first matching element in the array.
| pItem | Item to be removed. |
true if a matching pointer is found and removed,
false otherwise.Definition at line 909 of file karrayul.h.
| Type& operator[] | ( | int | pIndex | ) | const [inline] |
Returns a reference to the element at given position in the array.
| pIndex | Position of element in the array. |
Definition at line 925 of file karrayul.h.
{
#if defined(_DEBUG) && !defined(KARCH_ENV_MACOSX)
if (!ParentClass::ValidateIndex( pIndex ))
{
return (Type &)(ParentClass::mBaseArray[(0)*sizeof(Type)+ ParentClass::GetHeaderOffset() ]);
}
#endif
return (Type &)(ParentClass::mBaseArray[(pIndex)*sizeof(Type)+ ParentClass::GetHeaderOffset() ]);
}
| void SetAt | ( | int | pIndex, |
| Type | pItem | ||
| ) | [inline] |
Set the element at given position in the array.
| pIndex | Position of element in the array. |
| pItem | The new element. |
Definition at line 941 of file karrayul.h.
{
#if defined(_DEBUG) && !defined(KARCH_ENV_MACOSX)
if (!ParentClass::ValidateIndex( pIndex ))
{
return;
}
#endif
GetArray()[pIndex] = pItem;
}
| void SetLast | ( | Type | pItem | ) | [inline] |
Set the value of the last element.
| pItem | The new value of the last element. |
Definition at line 956 of file karrayul.h.
{
SetAt (ParentClass::GetArrayCount()-1, pItem);
}
| Type GetAt | ( | int | pIndex | ) | const [inline] |
Returns the value of the element at given position in the array.
| pIndex | Position of element in the array. |
Definition at line 966 of file karrayul.h.
{
#if defined(_DEBUG) && !defined(KARCH_ENV_MACOSX)
if (!ParentClass::ValidateIndex( pIndex ))
{
return (Type &)(ParentClass::mBaseArray[(0)*sizeof(Type)+ ParentClass::GetHeaderOffset() ]);
}
#endif
return (Type &)(ParentClass::mBaseArray[(pIndex)*sizeof(Type)+ ParentClass::GetHeaderOffset() ]);
}
| Type GetFirst | ( | ) | const [inline] |
Get the first element.
Definition at line 981 of file karrayul.h.
{
#ifdef KFBX_PRIVATE
K_ASSERT( ParentClass::GetArrayCount() >= 1 );
#endif
return GetAt(0);
}
| Type GetLast | ( | ) | const [inline] |
Get the last element.
Definition at line 993 of file karrayul.h.
{
#ifdef KFBX_PRIVATE
K_ASSERT( ParentClass::GetArrayCount() >= 1 );
#endif
return GetAt(ParentClass::GetArrayCount()-1);
}
| int Find | ( | Type | pItem | ) | const [inline] |
Find first matching element.
| pItem | The item to be compared to each of the elements. |
Definition at line 1005 of file karrayul.h.
{
return FindAfter( -1, pItem );
}
| int FindAfter | ( | int | pAfterIndex, |
| Type | pItem | ||
| ) | const [inline] |
Find first matching element after given index.
| pAfterIndex | The index after which the finding begins. |
| pItem | The item to be compared to each of the elements. |
Definition at line 1016 of file karrayul.h.
{
#ifdef KFBX_PRIVATE
#ifdef _DEBUG
if ( pAfterIndex > ParentClass::GetArrayCount() || pAfterIndex < -1 )
{
K_ASSERT_MSG_NOW (_T("ArrayUL : Search Begin Index out of range"));
return -1;
}
#endif
#endif
int Count;
for ( Count=pAfterIndex+1; Count<ParentClass::GetArrayCount(); Count++)
{
if (GetAt(Count)==pItem)
{
return Count;
}
}
return -1;
}
| int FindBefore | ( | int | pBeforeIndex, |
| Type | pItem | ||
| ) | const [inline] |
Find first matching pointer before given index.
| pBeforeIndex | The index before which the finding begins. |
| pItem | The item to be compared to each of the elements. |
Definition at line 1044 of file karrayul.h.
{
#ifdef KFBX_PRIVATE
#ifdef _DEBUG
if ( pBeforeIndex > ParentClass::GetArrayCount() || pBeforeIndex <= 0 )
{
K_ASSERT_MSG_NOW (_T("ArrayUL : Search Begin Index out of range"));
return -1;
}
#endif
#endif
int Count;
for ( Count=pBeforeIndex-1; Count>=0; Count--)
{
if (GetAt(Count)==pItem)
{
return Count;
}
}
return -1;
}
| int Add | ( | Type | pItem | ) | [inline] |
Append an element at the end of the array.
| pItem | Value to be copied to the new element. |
Definition at line 1070 of file karrayul.h.
{
return InsertAt(ParentClass::GetArrayCount(), pItem);
}
| int AddUnique | ( | Type | pItem | ) | [inline] |
Add Element at the end of array if not present.
| pItem | Value to be copied to the new element. |
Definition at line 1079 of file karrayul.h.
| void AddMultiple | ( | kUInt | pItemCount | ) | [inline] |
Add multiple elements at the end of array, use SetAt or GetArray to set the value of the new elements.
| pItemCount | How many new elements you want to add. |
Definition at line 1092 of file karrayul.h.
{
ParentClass::AddMultiple(pItemCount);
}
| void AddArray | ( | const KArrayTemplate< Type > & | pArray | ) | [inline] |
Append another array at the end of this array.
| pArray | Another array. |
Definition at line 1100 of file karrayul.h.
{
int lSourceIndex, lCount = pArray.GetCount();
if( lCount == 0 ) return;
int lDestinationIndex = ParentClass::GetCount();
AddMultiple(lCount);
for( lSourceIndex = 0; lSourceIndex < lCount; lSourceIndex++)
{
SetAt(lDestinationIndex++, pArray[lSourceIndex]);
}
}
| void AddArrayNoDuplicate | ( | const KArrayTemplate< Type > & | pArray | ) | [inline] |
Append the elements of another array at the end of this array if they are not present.
| pArray | Another array. |
Definition at line 1115 of file karrayul.h.
| void RemoveArray | ( | const KArrayTemplate< Type > & | pArray | ) | [inline] |
Remove the elements of another array from this array is they are present.
| pArray | Another array. |
Definition at line 1131 of file karrayul.h.
| Type* GetArray | ( | ) | const [inline] |
Get pointer to internal array of elements.
Definition at line 1141 of file karrayul.h.
{
if (ParentClass::mBaseArray == NULL)
return NULL;
return (Type*)(ParentClass::mBaseArray+ ParentClass::GetHeaderOffset()) ;
}
| KArrayTemplate<Type>& operator= | ( | const KArrayTemplate< Type > & | pArrayTemplate | ) | [inline] |
Copy array of elements.
Definition at line 1150 of file karrayul.h.
{
if ( this != &pArrayTemplate )
{
ParentClass::Clear();
int i, lCount = pArrayTemplate.GetCount();
for (i = 0; i < lCount; i++)
{
Add(pArrayTemplate[i]);
}
}
return (*this);
}
| operator Type * | ( | ) | [inline] |