#include <ArrayObjects.h>
Collaboration diagram for TArrayObjects< T, size, step >:
Public Member Functions | |
typedef | int (__cdecl *cmp_fce)(const void * |
Sorting function sort two items func(a,b):. | |
TArrayObjects (void) | |
Constructor. | |
~TArrayObjects (void) | |
Destructor. | |
TArrayObjects (const TArrayObjects< T, size, step > &orig) | |
Copy constructor. | |
void | operator= (const TArrayObjects< T, size, step > &orig) |
fake assignment operator | |
void | Set (const TArrayObjects< T, size, step > &orig) |
Copy objects from another array to this one. | |
DWORD | GetItemSize (void) const |
Return size of one item in this array. | |
void | Clear (void) |
Releases this list. | |
void | ClearDeallocOff (void) |
Releases this list. | |
void | ReserveSize (const DWORD &newSize) |
Resize array. | |
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 | AddItemUninitialized (void) |
This method new "add" item into array. | |
void | Insert (const T &item, const DWORD &index) |
Insert new item at specified position. | |
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. |
Unlike template TArray this template may be used for object types.
These types must have properly defined operator=, which is used in this class. Also default constructor and destructor should be properly defined. Also memory aligning is prefered in this template (operator new is used).
If item is destroyed then to this item is copy default value of given type with operator=.
If item type is pointer then before deleting list all pointers must be released manually!!! For non-pointers type destructors are called if exists.
For non-object type like scalar values or pointers is recommnded to use template TArray which provides better performance.
Definition at line 40 of file ArrayObjects.h.
|
Constructor.
Definition at line 122 of file ArrayObjects.h. |
|
Destructor. Release list. Call destructor to each item in array. Definition at line 159 of file ArrayObjects.h. |
|
Copy constructor.
Definition at line 138 of file ArrayObjects.h. References TArrayObjects< T, size, step >::alloc, TArrayObjects< T, size, step >::array, TArrayObjects< T, size, step >::count, and TArrayObjects< T, size, step >::onestep. |
|
Add item at end of list. New item is created via operator=.
Definition at line 261 of file ArrayObjects.h. References TArrayObjects< T, size, step >::ReserveSize(). Referenced by NSMath::NSCurves::THermiteCubicSpline::AddPoint(). Here is the call graph for this function: ![]() |
|
This method new "add" item into array. In fact method only increment number of items in array (which may result into reallocation array inside). After this increment "new" last item is uninitialized!!! This may be useful in situation when added item will be initialized via another method thus it needn't be initialized.
Definition at line 282 of file ArrayObjects.h. References TArrayObjects< T, size, step >::ReserveSize(). Here is the call graph for this function: ![]() |
|
Releases this list. Only sets number of items to 0 - memory is still allocated for one object! Definition at line 195 of file ArrayObjects.h. |
|
Releases this list. Only sets number of items to 0! No memory allocation is changed, thus method is very fast. Definition at line 210 of file ArrayObjects.h. |
|
Returns number of items in list.
Definition at line 240 of file ArrayObjects.h. Referenced by NSMath::NSCurves::THermiteCubicSpline::GetFirstDerivateValue(), NSMath::NSCurves::THermiteCubicSpline::GetIndexByTime(), NSMath::NSCurves::THermiteCubicSpline::GetIndexByUniformTime(), NSMath::NSCurves::THermiteCubicSpline::GetPoint(), NSMath::NSCurves::THermiteCubicSpline::GetPointCount(), NSMath::NSCurves::THermiteCubicSpline::GetSecondDerivateValue(), NSMath::NSCurves::THermiteCubicSpline::GetTangent(), and NSMath::NSCurves::THermiteCubicSpline::GetValue(). |
|
Returns number of allocated items.
Definition at line 250 of file ArrayObjects.h. |
|
Return pointer to array of items stored in this list!!!
Definition at line 510 of file ArrayObjects.h. |
|
Return pointer to array of items stored in this list!!!
Definition at line 500 of file ArrayObjects.h. |
|
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 392 of file ArrayObjects.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 422 of file ArrayObjects.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 407 of file ArrayObjects.h. References DBGASSERT. |
|
Return size of one item in this array.
Definition at line 113 of file ArrayObjects.h. |
|
Gets last item in array.
Definition at line 464 of file ArrayObjects.h. References DBGASSERT. |
|
Gets reference to last item in array.
Definition at line 488 of file ArrayObjects.h. References DBGASSERT. |
|
Gets reference to last item in array.
Definition at line 476 of file ArrayObjects.h. References DBGASSERT. |
|
Returns number of items in list.
Definition at line 220 of file ArrayObjects.h. |
|
Insert new item at specified position. New item is created via operator=.
Definition at line 300 of file ArrayObjects.h. References DBGASSERT, and TArrayObjects< T, 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 452 of file ArrayObjects.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 437 of file ArrayObjects.h. References DBGASSERT. |
|
Remove item with given index from array. No destructor is called to item!!! Item is destroyed by assigning to default value via default constructor T item=T(); Thus class must have properly defined operator= and default constructor.
Definition at line 329 of file ArrayObjects.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!!! Item is destroyed by assigning to default value via default constructor T item=T(); Thus class must have properly defined operator= and default constructor.
Definition at line 354 of file ArrayObjects.h. References DBGASSERT. |
|
Remove last item in array. No destructor is called to item!!! Item is destroyed by assigning to default value via default constructor T item=T(); Thus class must have properly defined operator= and default constructor. Definition at line 373 of file ArrayObjects.h. |
|
Resize array. 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 operator=.
Definition at line 541 of file ArrayObjects.h. Referenced by TArrayObjects< T, size, step >::AddItem(), TArrayObjects< T, size, step >::AddItemUninitialized(), and TArrayObjects< T, size, step >::Insert(). |
|
Reverse order of items in array.
Definition at line 565 of file ArrayObjects.h. |
|
Copy objects from another array to this one. Use operator=.
Definition at line 173 of file ArrayObjects.h. References TArrayObjects< T, size, step >::alloc, TArrayObjects< T, size, step >::array, TArrayObjects< T, size, step >::count, and TArrayObjects< T, size, step >::onestep. Referenced by NSMath::NSCurves::THermiteCubicSpline::Set(). |
|
Returns number of items in list.
Definition at line 230 of file ArrayObjects.h. Referenced by NSMath::NSCurves::THermiteCubicSpline::Add(), NSMath::NSCurves::THermiteCubicSpline::ChangeTangent(), NSMath::NSCurves::THermiteCubicSpline::GetFirstDerivateValue(), NSMath::NSCurves::THermiteCubicSpline::GetLength(), NSMath::NSCurves::THermiteCubicSpline::GetSecondDerivateValue(), NSMath::NSCurves::THermiteCubicSpline::GetValue(), NSMath::NSCurves::THermiteCubicSpline::Move(), NSMath::NSCurves::THermiteCubicSpline::MovePoint(), and NSMath::NSCurves::THermiteCubicSpline::Sub(). |
|
Sort this list by given sorting function. Sorting function sort two items func(a,b):
* < 0 .... a < b * = 0 .... a = b * > 0 .... a > b *
Definition at line 528 of file ArrayObjects.h. |