#include <Array.h>
Collaboration diagram for TArray< T, align, size, step >:
Public Member Functions | |
typedef | int (__cdecl *cmp_fce)(const void * |
Sorting function sort two items func(a,b):. | |
TArray (void) | |
Constructor. | |
~TArray (void) | |
Destructor. | |
TArray (const TArray< T, align, size, step > &orig) | |
Copy constructor. | |
void | operator= (const TArray< T, align, size, step > &orig) |
fake assignment operator | |
DWORD | GetItemSize (void) const |
Return size of one item in this array in bytes. | |
void | Set (const TArray< T, align, size, step > &orig) |
Sets array with values from another array. | |
void | Clear (void) |
Releases this list. | |
void | ClearDeallocOff (void) |
Releases this list. | |
void | ReserveSize (const DWORD &newSize) |
Resize array. | |
void | ReSizeAndFill (const DWORD &newSize) |
Resize array and fill all its elements. | |
DWORD | GetSize (void) const |
Returns number of items in list. | |
DWORD | Size (void) const |
Returns number of items in list. | |
DWORD | Count (void) const |
Returns number of items in list. | |
DWORD | GetAllocatedSpace (void) const |
Returns number of allocated items. | |
void | AddItem (const T &item) |
Add item at end of list. | |
void | Insert (const T &item, const DWORD &index) |
Insert new item to specified index. | |
void | RemoveItem (const DWORD &index) |
Remove item with given index from array. | |
void | RemoveItemFast (const DWORD &index) |
Remove item with given index from array. | |
void | RemoveLastItem (void) |
Remove last item in array. | |
T | GetItem (const DWORD &index) const |
Gets item on desired index. | |
T & | GetItemRef (const DWORD &index) |
Gets reference to item on desired index. | |
const T & | GetItemRef (const DWORD &index) const |
Gets reference to item on desired index. | |
T & | operator[] (const DWORD &index) |
Gets reference to item on desired index. | |
const T & | operator[] (const DWORD &index) const |
Gets reference to item on desired index. | |
T | GetLastItem (void) const |
Gets last item in array. | |
T & | GetLastItemRef (void) |
Gets reference to last item in array. | |
const T & | GetLastItemRef (void) const |
Gets reference to last item in array. | |
T * | GetArray (void) |
Return pointer to array of items stored in this list!!! | |
const T * | GetArray (void) const |
Return pointer to array of items stored in this list!!! | |
void | Sort (cmp_fce func) |
Sort this list by given sorting function. | |
void | Reverse (void) |
Reverse order of items in array. |
This template should be only used for pointers and structures which are copy via standard copy constructor. Using this template for class with non-standard copy constructor may result into undefined behavior. Because memory is allocated inside this list via malloc(), objects are not aligned, thus only objects WITHOUT ALIGMENT requierment works correctly.
Inside class items are copied as memory block - NO operator=() .
While releasing list no destructor are called (inner array is destroy via free()) - all items must be destroyed manualy. Thus if item is pointer then parent object must go through entire list and call delete for any pointer if this pointer points on object type.
Assign this class is PROHIBITED via non-implemented copy constructor.
If item type is pointer then before deleting list all pointers must be released manually!!! For non-pointers type same method for destroying must be called for all items if it's required (e.g. type contains pointer to allocated memory).
Parameters for template are:
T typr align bytes align when array is allocated size initial size of array step number of items added while array is reallocated
Definition at line 50 of file Array.h.
|
Constructor.
Definition at line 133 of file Array.h. References TMemManager::new_align(). Here is the call graph for this function: ![]() |
|
Destructor. Release list. Do not release items in list, it must be released manually. Definition at line 165 of file Array.h. References TMemManager::free_align(). Here is the call graph for this function: ![]() |
|
Copy constructor.
Definition at line 149 of file Array.h. References TArray< T, align, size, step >::alloc, TArray< T, align, size, step >::array, TArray< T, align, size, step >::count, TMemManager::new_align(), and TArray< T, align, size, step >::onestep. Here is the call graph for this function: ![]() |
|
Add item at end of list. New item is created with copy of memory block.
Definition at line 266 of file Array.h. References TArray< T, align, size, step >::ReserveSize(). Referenced by NSMeshes::TMeshCreator::CreateDeclarationArray(), NSXLoader::TXFrame::Export_XYZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ_TUTV(), and NSXLoader::TXFrame::Export_XYZ_TUTV(). Here is the call graph for this function: ![]() |
|
Releases this list. Only sets number of items to 0 - memory is still allocated only for one object! No destructors are called for object type! Definition at line 197 of file Array.h. References TMemManager::free_align(), and TMemManager::new_align(). Referenced by NSXLoader::TXFrame::Export_XYZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ_TUTV(), NSXLoader::TXFrame::Export_XYZ_TUTV(), TRendererCreatorHelper::FindRenderersHW(), TRendererCreatorHelper::FindRenderersSW(), and TRendererCreatorHelper::FreeEnumerateRenderers(). Here is the call graph for this function: ![]() |
|
Releases this list. Only sets number of items to 0. After calling this method memory is allocated in the same way as before calling. From this reason method is more effective than Clear method. |
|
Returns number of items in list.
|
|
Returns number of allocated items. Array contains preallocated items for newly added items
|
|
Return pointer to array of items stored in this list!!!
|
|
Return pointer to array of items stored in this list!!!
|
|
Gets item on desired index. Creates new item with copy constructor!!! Please use GetItemRef() or operator=() for reference getting. Index must be in range <0,count-1>
Definition at line 370 of file Array.h. References DBGASSERT. Referenced by TRendererCreatorHelper::FindRenderersHW(), and TRendererCreatorHelper::FindRenderersSW(). |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 400 of file Array.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 385 of file Array.h. References DBGASSERT. Referenced by NSXLoader::TXFrame::Export_XYZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ_TUTV(), and NSXLoader::TXFrame::Export_XYZ_TUTV(). |
|
Return size of one item in this array in bytes.
|
|
Gets last item in array.
Definition at line 442 of file Array.h. References DBGASSERT. |
|
Gets reference to last item in array.
Definition at line 466 of file Array.h. References DBGASSERT. |
|
Gets reference to last item in array.
Definition at line 454 of file Array.h. References DBGASSERT. |
|
Returns number of items in list.
Definition at line 224 of file Array.h. Referenced by NSXLoader::TXFrame::Export_XYZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ_TUTV(), NSXLoader::TXFrame::Export_XYZ_TUTV(), TRendererCreatorHelper::FindRenderersHW(), TRendererCreatorHelper::FindRenderersSW(), NSXLoader::TXBone::GetVerticesCount(), and NSMeshes::TMeshLoader::SaveMeshToFile(). |
|
Insert new item to specified index. Index must be in range.
Definition at line 285 of file Array.h. References DBGASSERT, and TArray< T, align, size, step >::ReserveSize(). Here is the call graph for this function: ![]() |
|
Sorting function sort two items func(a,b):.
* < 0 .... a < b * = 0 .... a = b * > 0 .... a > b * |
|
fake assignment operator
|
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 430 of file Array.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 415 of file Array.h. References DBGASSERT. |
|
Remove item with given index from array. No destructor is called to item!!!
Definition at line 312 of file Array.h. References DBGASSERT. |
|
Remove item with given index from array. This methods change order of items in list!!! Last item is set to deleted item. No destructor is called to item!!!
Definition at line 334 of file Array.h. References DBGASSERT. |
|
Remove last item in array. No destructor is called to item!!! Only decrease number of items, thus this method is very fast. |
|
Resize array. Number of elements stay unchanged. Only allocates space is changed. Original array items are copy to new array. If size in parameter is less than actual size than new size is set to actual size thus methods do nothing. Items are copy via memory - no copy constructor or operator= is used.
Definition at line 520 of file Array.h. References TMemManager::free_align(), and TMemManager::new_align(). Referenced by TArray< T, align, size, step >::AddItem(), NSXLoader::TXFrame::Export_XYZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ(), NSXLoader::TXFrame::Export_XYZ_NXNYNZ_TUTV(), NSXLoader::TXFrame::Export_XYZ_TUTV(), and TArray< T, align, size, step >::Insert(). Here is the call graph for this function: ![]() |
|
Resize array and fill all its elements. This method is useful for copying data from file into array as chunk of bytes. Original array items are copy to new array. Other items are set to random values. If size in parameter is less than actual size than new size is set to actual size thus methods do nothing. Items are copy via memory - no copy constructor or operator= is used.
Definition at line 546 of file Array.h. References TMemManager::free_align(), and TMemManager::new_align(). Here is the call graph for this function: ![]() |
|
Reverse order of items in array.
Definition at line 572 of file Array.h. References TMemManager::new_align(). Here is the call graph for this function: ![]() |
|
Sets array with values from another array. (Creates identical copy) Previous array is deallocated and new is allocated. Items are copy via memcpy function.
Definition at line 180 of file Array.h. References TArray< T, align, size, step >::alloc, TArray< T, align, size, step >::array, TArray< T, align, size, step >::count, TMemManager::free_align(), TMemManager::new_align(), and TArray< T, align, size, step >::onestep. Here is the call graph for this function: ![]() |
|
Returns number of items in list.
|
|
Sort this list by given sorting function. Sorting function sort two items func(a,b):
* < 0 .... a < b * = 0 .... a = b * > 0 .... a > b *
|