#include <IceContainer.h>
Private Member Functions | |
bool | Resize (udword needed=1) |
Private Attributes | |
udword | mCurNbEntries |
Current number of entries. More... | |
udword * | mEntries |
List of entries. More... | |
float | mGrowthFactor |
Resize: new number of entries = old number * mGrowthFactor. More... | |
udword | mMaxNbEntries |
Maximum possible number of entries. More... | |
Static Private Attributes | |
static udword | mNbContainers |
Number of containers around. More... | |
static udword | mUsedRam |
Amount of bytes used by containers in the system. More... | |
Contains a list of 32-bits values. Use this class when you need to store an unknown number of values. The list is automatically resized and can contains 32-bits entities (dwords or floats)
Definition at line 25 of file IceContainer.h.
Container::Container | ( | ) |
Container::Container | ( | udword | size, |
float | growth_factor | ||
) |
Container::~Container | ( | ) |
A O(1) method to add a value in the container. The container is automatically resized if needed. The method is inline, not the resize. The call overhead happens on resizes only, which is not a problem since the resizing operation costs a lot more than the call overhead...
entry | [in] a udword to store in the container |
Definition at line 47 of file IceContainer.h.
Definition at line 57 of file IceContainer.h.
A O(1) method to add a value in the container. The container is automatically resized if needed. The method is inline, not the resize. The call overhead happens on resizes only, which is not a problem since the resizing operation costs a lot more than the call overhead...
entry | [in] a float to store in the container |
Definition at line 81 of file IceContainer.h.
Definition at line 91 of file IceContainer.h.
Add unique [slow].
Definition at line 103 of file IceContainer.h.
bool Container::Delete | ( | udword | entry | ) |
Deletes the entry whose index is given.
Definition at line 164 of file IceContainer.h.
bool Container::DeleteKeepingOrder | ( | udword | entry | ) |
Deletes the very last entry.
Definition at line 162 of file IceContainer.h.
Container& Container::Empty | ( | ) |
Clears the container. All stored values are deleted, and it frees used ram.
Container& Container::FindNext | ( | udword & | entry, |
FindMode | find_mode = FIND_CLAMP |
||
) |
Container& Container::FindPrev | ( | udword & | entry, |
FindMode | find_mode = FIND_CLAMP |
||
) |
Definition at line 133 of file IceContainer.h.
Returns the list of entries.
Definition at line 172 of file IceContainer.h.
Returns ith entry.
Definition at line 171 of file IceContainer.h.
Definition at line 174 of file IceContainer.h.
|
inline |
Returns the growth factor.
Definition at line 178 of file IceContainer.h.
Definition at line 175 of file IceContainer.h.
Operator for "Container A = Container B".
Definition at line 195 of file IceContainer.h.
Returns the current number of entries.
Definition at line 170 of file IceContainer.h.
Definition at line 196 of file IceContainer.h.
udword Container::GetUsedRam | ( | ) | const |
|
inline |
Checks the container is full.
Definition at line 180 of file IceContainer.h.
Checks the container is empty.
Definition at line 181 of file IceContainer.h.
Read-access as an array.
Definition at line 184 of file IceContainer.h.
Write-access as an array.
Definition at line 186 of file IceContainer.h.
bool Container::Refit | ( | ) |
Refits the container and get rid of unused bytes.
Resets the container. Stored values are discarded but the buffer is kept so that further calls don't need resizing again. That's a kind of temporal coherence.
Definition at line 125 of file IceContainer.h.
|
private |
Sets the growth factor.
Definition at line 179 of file IceContainer.h.
bool Container::SetSize | ( | udword | nb | ) |
Sets the initial size of the container. If it already contains something, it's discarded.
nb | [in] Number of entries |
|
private |
Current number of entries.
Definition at line 207 of file IceContainer.h.
|
private |
List of entries.
Definition at line 208 of file IceContainer.h.
|
private |
Resize: new number of entries = old number * mGrowthFactor.
Definition at line 209 of file IceContainer.h.
|
private |
Maximum possible number of entries.
Definition at line 206 of file IceContainer.h.
|
staticprivate |
Number of containers around.
Definition at line 199 of file IceContainer.h.
|
staticprivate |
Amount of bytes used by containers in the system.
Definition at line 200 of file IceContainer.h.