|
HDK
|
A thread-safe hash map which stores indexed shared items. More...
#include <UT_IndexedHashSet.h>
Classes | |
| class | IdAndRefCount |
| class | IdRemapping |
| class | unsafe_iterator |
| Iterate over items in the map - this is arbitrary order. More... | |
| class | unsafe_listiterator |
Public Types | |
| typedef UT_ConcurrentHashMap < T, IdAndRefCount > | UT_IndexedHashSetTable |
| typedef UT_ConcurrentVector< T > | UT_IndexedHashSetVector |
| typedef UT_ConcurrentQueue < UT_IndexedHashSetItemId > | UT_IndexedHashSetHoleQueue |
A thread-safe hash map which stores indexed shared items.
Each item in the hash map is reference counted. That is, if objects are added multiple times, only a single object will be stored in the map.
Removing an item from the hash map (by id or key) will decrement the reference count on the item. When no longer referenced, the map will delete the item.
Each item is assigned a unique id (UT_IndexedHashSetItemId). The item can then be retrieved efficiently from the map using the id (UT_IndexedHashSet::get())
Many methods on the map are thread-safe. Some methods are not (and are noted in the comments).
Definition at line 44 of file UT_IndexedHashSet.h.
| typedef UT_ConcurrentQueue<UT_IndexedHashSetItemId> UT_IndexedHashSet< T >::UT_IndexedHashSetHoleQueue |
Definition at line 228 of file UT_IndexedHashSet.h.
| typedef UT_ConcurrentHashMap<T, IdAndRefCount> UT_IndexedHashSet< T >::UT_IndexedHashSetTable |
Definition at line 225 of file UT_IndexedHashSet.h.
| typedef UT_ConcurrentVector<T> UT_IndexedHashSet< T >::UT_IndexedHashSetVector |
Definition at line 226 of file UT_IndexedHashSet.h.
|
inline |
Each item stored in the map will be given a unique id of type UT_IndexedHashSetItemId. These id's can be used to perform efficient lookup of items in the map.
Definition at line 50 of file UT_IndexedHashSet.h.
|
inline |
Definition at line 53 of file UT_IndexedHashSet.h.
| UT_IndexedHashSetItemId UT_IndexedHashSet< T >::add | ( | const T & | key | ) |
Definition at line 169 of file UT_IndexedHashSetImpl.h.
| const T * UT_IndexedHashSet< T >::addReference | ( | UT_IndexedHashSetItemId | id, |
| int | inc | ||
| ) |
This may return null if inc is negative and the reference count reaches zero, or if the ID is out of range.
Definition at line 84 of file UT_IndexedHashSetImpl.h.
|
inline |
Definition at line 148 of file UT_IndexedHashSet.h.
|
inline |
Definition at line 365 of file UT_IndexedHashSet.h.
|
inline |
Definition at line 369 of file UT_IndexedHashSet.h.
| void UT_IndexedHashSet< T >::clear | ( | ) |
| bool UT_IndexedHashSet< T >::compactIds | ( | IdRemapping & | remapping | ) |
Compact the list. This fills out the integer map of old id's and their new id's. If no compaction was done, the function returns false.
Definition at line 313 of file UT_IndexedHashSetImpl.h.
|
inline |
Return whether the map is empty.
Definition at line 67 of file UT_IndexedHashSet.h.
|
inline |
Definition at line 367 of file UT_IndexedHashSet.h.
|
inline |
Definition at line 371 of file UT_IndexedHashSet.h.
|
inline |
Return the number of entries in the map.
Definition at line 64 of file UT_IndexedHashSet.h.
| exint UT_IndexedHashSet< T >::extractItems | ( | ID_ARRAY & | ids, |
| T_ARRAY & | items, | ||
| exint | maxitems | ||
| ) | const |
Definition at line 376 of file UT_IndexedHashSetImpl.h.
| exint UT_IndexedHashSet< T >::extractItems | ( | ID_ARRAY & | ids, |
| T_ARRAY & | items | ||
| ) | const |
Definition at line 406 of file UT_IndexedHashSetImpl.h.
| exint UT_IndexedHashSet< T >::extractItems | ( | T_ARRAY & | items | ) | const |
Definition at line 429 of file UT_IndexedHashSetImpl.h.
|
inline |
Definition at line 151 of file UT_IndexedHashSet.h.
| const T * UT_IndexedHashSet< T >::findItemAndId | ( | const T & | key, |
| UT_IndexedHashSetItemId & | id | ||
| ) | const |
Definition at line 192 of file UT_IndexedHashSetImpl.h.
|
inline |
Definition at line 160 of file UT_IndexedHashSet.h.
|
inline |
Return the maximum possible UT_IndexedHashSetItemId stored in the map. This returns an upper bound and is not exact.
Definition at line 75 of file UT_IndexedHashSet.h.
| int64 UT_IndexedHashSet< T >::getMemoryUsage | ( | bool | inclusive | ) | const |
Return approximate memory usage (not including key or item storage)
Definition at line 443 of file UT_IndexedHashSetImpl.h.
|
inline |
Return the "occupancy" of the map.
Definition at line 80 of file UT_IndexedHashSet.h.
| const T * UT_IndexedHashSet< T >::getOrderedItem | ( | exint | index, |
| UT_IndexedHashSetItemId * | id = nullptr |
||
| ) | const |
Definition at line 60 of file UT_IndexedHashSetImpl.h.
| exint UT_IndexedHashSet< T >::getReferenceCount | ( | UT_IndexedHashSetItemId | id | ) | const |
Definition at line 120 of file UT_IndexedHashSetImpl.h.
| exint UT_IndexedHashSet< T >::getReferenceCount | ( | const T & | key | ) | const |
Definition at line 137 of file UT_IndexedHashSetImpl.h.
| bool UT_IndexedHashSet< T >::remove | ( | const T & | key | ) |
Definition at line 207 of file UT_IndexedHashSetImpl.h.
| bool UT_IndexedHashSet< T >::remove | ( | UT_IndexedHashSetItemId | id | ) |
Definition at line 235 of file UT_IndexedHashSetImpl.h.
| void UT_IndexedHashSet< T >::replace | ( | const UT_IndexedHashSet< T > & | src | ) |
Replace with the contents of another map.
Definition at line 47 of file UT_IndexedHashSetImpl.h.
| UT_IndexedHashSetItemId UT_IndexedHashSet< T >::replaceItem | ( | UT_IndexedHashSetItemId | id, |
| const T & | key | ||
| ) |
Definition at line 250 of file UT_IndexedHashSetImpl.h.
| bool UT_IndexedHashSet< T >::sortItems | ( | const P & | predicate | ) |
Sort the list of ids based on the comparator. This method only works if the table has been compacted. Returns false if there are no ids or the list is not compacted.
Definition at line 348 of file UT_IndexedHashSetImpl.h.