#include <OPC_IceHook.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... | |
Definition at line 26 of file OPC_IceHook.h.
Container::Container | ( | ) |
Constructor. No entries allocated there.
Definition at line 40 of file IceContainer.cpp.
Copy constructor.
Definition at line 67 of file IceContainer.cpp.
Container::Container | ( | udword | size, |
float | growth_factor | ||
) |
Constructor. Also allocates a given number of entries.
Definition at line 53 of file IceContainer.cpp.
Container::~Container | ( | ) |
Destructor. Frees everything and leaves.
Definition at line 81 of file IceContainer.cpp.
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 48 of file OPC_IceHook.h.
Definition at line 58 of file OPC_IceHook.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 82 of file OPC_IceHook.h.
Definition at line 92 of file OPC_IceHook.h.
Add unique [slow].
Definition at line 104 of file OPC_IceHook.h.
Checks whether the container already contains a given value.
entry | [in] the value to look for in the container |
location | [out] a possible pointer to store the entry location |
Definition at line 224 of file IceContainer.cpp.
bool Container::Delete | ( | udword | entry | ) |
Deletes an entry. If the container contains such an entry, it's removed.
entry | [in] the value to delete. |
Definition at line 246 of file IceContainer.cpp.
Deletes the entry whose index is given.
Definition at line 165 of file OPC_IceHook.h.
bool Container::DeleteKeepingOrder | ( | udword | entry | ) |
Deletes an entry, preserving the insertion order. If the container contains such an entry, it's removed.
entry | [in] the value to delete. |
Definition at line 269 of file IceContainer.cpp.
Deletes the very last entry.
Definition at line 163 of file OPC_IceHook.h.
Container & Container::Empty | ( | ) |
Clears the container. All stored values are deleted, and it frees used ram.
Definition at line 97 of file IceContainer.cpp.
Container & Container::FindNext | ( | udword & | entry, |
FindMode | find_mode = FIND_CLAMP |
||
) |
Gets the next entry, starting from input one.
entry | [in/out] On input, the entry to look for. On output, the next entry |
find_mode | [in] wrap/clamp |
Definition at line 297 of file IceContainer.cpp.
Container & Container::FindPrev | ( | udword & | entry, |
FindMode | find_mode = FIND_CLAMP |
||
) |
Gets the previous entry, starting from input one.
entry | [in/out] On input, the entry to look for. On output, the previous entry |
find_mode | [in] wrap/clamp |
Definition at line 317 of file IceContainer.cpp.
Definition at line 134 of file OPC_IceHook.h.
Returns the list of entries.
Definition at line 173 of file OPC_IceHook.h.
Returns ith entry.
Definition at line 172 of file OPC_IceHook.h.
Definition at line 175 of file OPC_IceHook.h.
|
inline |
Returns the growth factor.
Definition at line 179 of file OPC_IceHook.h.
Definition at line 176 of file OPC_IceHook.h.
Operator for "Container A = Container B".
Definition at line 196 of file OPC_IceHook.h.
Returns the current number of entries.
Definition at line 171 of file OPC_IceHook.h.
Definition at line 197 of file OPC_IceHook.h.
udword Container::GetUsedRam | ( | ) | const |
Gets the ram used by the container.
Definition at line 335 of file IceContainer.cpp.
|
inline |
Checks the container is full.
Definition at line 181 of file OPC_IceHook.h.
Checks the container is empty.
Definition at line 182 of file OPC_IceHook.h.
Read-access as an array.
Definition at line 185 of file OPC_IceHook.h.
Write-access as an array.
Definition at line 187 of file OPC_IceHook.h.
bool Container::Refit | ( | ) |
Refits the container and get rid of unused bytes.
Definition at line 181 of file IceContainer.cpp.
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 126 of file OPC_IceHook.h.
|
private |
Resizes the container.
needed | [in] assume the container can be added at least "needed" values |
Definition at line 114 of file IceContainer.cpp.
Sets the growth factor.
Definition at line 180 of file OPC_IceHook.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 |
Definition at line 153 of file IceContainer.cpp.
|
private |
Current number of entries.
Definition at line 208 of file OPC_IceHook.h.
|
private |
List of entries.
Definition at line 209 of file OPC_IceHook.h.
|
private |
Resize: new number of entries = old number * mGrowthFactor.
Definition at line 210 of file OPC_IceHook.h.
|
private |
Maximum possible number of entries.
Definition at line 207 of file OPC_IceHook.h.
|
staticprivate |
Number of containers around.
Definition at line 200 of file OPC_IceHook.h.
|
staticprivate |
Amount of bytes used by containers in the system.
Definition at line 201 of file OPC_IceHook.h.