Support Forum G3D Web Page |
A Table that can be iterated through by index, preserves ordering, and implicitly supports removal during iteration.
More...
Public Member Functions | |
void | clear () |
bool | containsKey (const Key &key) const |
bool | containsValue (const Value &v) const |
void | fastRemoveKey (const Key &k) |
Removes the element with this key by swapping it with the last element. More... | |
int | findIndexOfKey (const Key &key) const |
Returns -1 if not found. More... | |
int | findIndexOfValue (const Value &value) const |
Returns -1 if not found. More... | |
int | index (const Key &key) const |
Returns the index for this key (same as findIndexOfKey) More... | |
const Key & | key (int i) const |
Return the key for this index. More... | |
void | removeKey (const Key &k) |
Removes the element with this key and slides other elements down to fill the hole. More... | |
void | set (const Key &key, const Value &value) |
int | size () const |
Value & | valueFromIndex (int i) |
const Value & | valueFromIndex (int i) const |
Value & | valueFromKey (const Key &k) |
const Value & | valueFromKey (const Key &k) const |
A Table that can be iterated through by index, preserves ordering, and implicitly supports removal during iteration.
Useful for creating arrays of Entitys or other objects that need efficient fetch by name or ID but also efficient, order-preserving iteration.
Does not overload operator[] to avoid ambiguity when the Key is an integer type.
|
inline |
|
inline |
|
inline |
|
inline |
Removes the element with this key by swapping it with the last element.
Amortized expected O(1) time.
|
inline |
Returns -1 if not found.
O(1) amortized expected time.
Referenced by G3D::OrderedTable< Key, Value >::index().
|
inline |
Returns -1 if not found.
O(n) expected time.
Referenced by G3D::OrderedTable< Key, Value >::containsValue().
|
inline |
Returns the index for this key (same as findIndexOfKey)
Referenced by G3D::OrderedTable< Key, Value >::set().
|
inline |
Return the key for this index.
Referenced by G3D::OrderedTable< Key, Value >::containsKey(), G3D::OrderedTable< Key, Value >::findIndexOfKey(), G3D::OrderedTable< Key, Value >::index(), and G3D::OrderedTable< Key, Value >::set().
|
inline |
Removes the element with this key and slides other elements down to fill the hole.
O(n) time in the size of the table.
|
inline |
|
inline |
|
inline |
Referenced by G3D::OrderedTable< Key, Value >::valueFromIndex().
|
inline |
|
inline |
Referenced by G3D::OrderedTable< Key, Value >::valueFromKey().
|
inline |