#include <IndexedSet.h>
Collaboration diagram for TIndexedSet< T, size, step >:
Public Member Functions | |
TIndexedSet (void) | |
Constructor. | |
~TIndexedSet (void) | |
Destructor. | |
TIndexedSet (const TIndexedSet< T, size, step > &orig) | |
fake copy constructor | |
void | operator= (const TIndexedSet< T, size, step > &orig) |
fake assignment operator | |
DWORD | GetItemSize (void) const |
Return size of one item in this set. | |
void | Set (const TIndexedSet< T, size, step > &orig) |
Sets array with values from another array. | |
void | Clear (void) |
Releases this list. | |
void | ReserveSize (const DWORD &newSize) |
Resize array. | |
DWORD | GetSize (void) const |
Returns number of items in list. | |
DWORD | GetAllocatedSpace (void) const |
Returns number of allocated items. | |
DWORD | AddItem (const T &item) |
Add item at end of list if item doesnt exists inside and returns its index. | |
BOOL | IsInside (const T &item) const |
Determines whether specified item exists in set. | |
DWORD | GetItemIndex (const T &item) const |
Returns index of specified item. | |
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 * | 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!!! |
It is set where each item is unique.
Class should be used only for simle data types, pointers and structures (and classes) with default assignment operator and no alignment. Each used item must have default copy constructor. Also type of used item must have implemented OPERATOR == !!!
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).
Definition at line 43 of file IndexedSet.h.
|
Constructor.
Definition at line 96 of file IndexedSet.h. References TMemManager::new_mem(). Here is the call graph for this function: ![]() |
|
Destructor. Release indexed set. Do not release items in list, it must be released manually (only for pointer types). Definition at line 112 of file IndexedSet.h. References TMemManager::free_mem(). Here is the call graph for this function: ![]() |
|
fake copy constructor
|
|
Add item at end of list if item doesnt exists inside and returns its index. If items already exists inside then no action is performed and index of item is returned. New item is created with copy of memory block.
Definition at line 208 of file IndexedSet.h. |
|
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 146 of file IndexedSet.h. References TMemManager::free_mem(), and TMemManager::new_mem(). Here is the call graph for this function: ![]() |
|
Returns number of allocated items.
Definition at line 196 of file IndexedSet.h. |
|
Return pointer to array of items stored in this list!!!
Definition at line 363 of file IndexedSet.h. |
|
Return pointer to array of items stored in this list!!!
Definition at line 353 of file IndexedSet.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 286 of file IndexedSet.h. References DBGASSERT. |
|
Returns index of specified item. If item doesnt exists then -1 is returned.
Definition at line 260 of file IndexedSet.h. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 314 of file IndexedSet.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 300 of file IndexedSet.h. References DBGASSERT. |
|
Return size of one item in this set.
Definition at line 87 of file IndexedSet.h. |
|
Returns number of items in list.
Definition at line 186 of file IndexedSet.h. |
|
Determines whether specified item exists in set.
Definition at line 241 of file IndexedSet.h. |
|
fake assignment operator
|
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 342 of file IndexedSet.h. References DBGASSERT. |
|
Gets reference to item on desired index. Index must be in range <0,count-1>
Definition at line 328 of file IndexedSet.h. References DBGASSERT. |
|
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 memory - no copy constructor or operator= is used.
Definition at line 166 of file IndexedSet.h. References TMemManager::free_mem(), and TMemManager::new_mem(). Here is the call graph for this function: ![]() |
|
Sets array with values from another array. (Creates identical copy)
Definition at line 127 of file IndexedSet.h. References TIndexedSet< T, size, step >::alloc, TIndexedSet< T, size, step >::array, TIndexedSet< T, size, step >::count, TMemManager::free_mem(), TMemManager::new_mem(), and TIndexedSet< T, size, step >::onestep. Here is the call graph for this function: ![]() |