|
| CoreOrderedHashTable (const unsigned int &default_size=16) |
| Default Constructor.
|
|
| CoreOrderedHashTable (const CoreOrderedHashTable &dic) |
| Copy constructor.
|
|
size_t | get_memory_size () const |
| Gets the current memory usage of the dictionary.
|
|
void | add (const T &key, const U &item) |
| Adds an entry in the dictionary.
|
|
void | remove (const T &key) |
| Removes an entry from the dictionary.
|
|
void | remove_all () |
| Removes all the entries from the dictionary.
|
|
bool | is_empty () const |
| Dictionnary entries emptyness accessor.
|
|
const unsigned int & | get_count () const |
| Dictionnary entries count accessor.
|
|
CoreArray< T > | get_keys () const |
| Get all the keys from the dictionary.
|
|
U * | is_key_exists (const T &key) const |
| Tests the key existency in the dictionary.
|
|
CoreArray< U > | get_values () const |
| Get all the data of the dictionary as an array.
|
|
U & | get_value (const T &key) const |
| Access an item by key.
|
|
U & | operator[] (const T &key) |
| Access an item by key.
|
|
const U & | operator[] (const T &key) const |
| const Access an item by key
|
|
void | move (const unsigned int &from, const unsigned int &to) |
| Moves data from an index to another.
|
|
void | move (const CoreArray< T > &items, const T &tgt_item, const bool add_after=true) |
| Moves a set of data to a specified index.
|
|
unsigned int | find_index (const T &key) const |
| Retrieves the index of an item.
|
|
U & | operator[] (const unsigned int &index) |
| Access an item by index.
|
|
const U & | operator[] (const unsigned int &index) const |
| Access an item by index.
|
|
Iterator | get_iterator () |
| Create an iterator from the beginning of the dictionary.
|
|
Iterator | get_iterator () const |
| Create an iterator from the beginning of the dictionary.
|
|
template<class T, class U>
class CoreOrderedHashTable< T, U >
CoreOrderedHashTable provides an implementation of a container of U based on an hash_table< T, unsigned int > and two vectors vector< U > for storing data and vector< unsigned int > to manage sorting.
- Note
- This implementation performs auto-resize of the hash_table and the vectors on add/remove methods above a certain threshold, under the threshold we manage null entries in the data vector
-
This implementation is NOT RECOMMENDED for non pointer usage, due to null value (0) used internally to consider data entry has invalid !!!
- Warning
- However, if the template parameter T is specialized with a non pointer type, core_get_null_value() must be implemented for the specialized type
- See Also
- core_get_null_value