OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_HashMap.h>
Classes | |
struct | Iterator |
Public Types | |
using | ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType |
Public Member Functions | |
HashMap (int numberOfSlots=defaultHashTableSize, HashFunctionType hashFunction=HashFunctionType()) | |
~HashMap () | |
void | clear () |
int | size () const noexcept |
ValueType | operator[] (KeyTypeParameter keyToLookFor) const |
ValueType & | getReference (KeyTypeParameter keyToLookFor) |
bool | contains (KeyTypeParameter keyToLookFor) const |
bool | containsValue (ValueTypeParameter valueToLookFor) const |
void | set (KeyTypeParameter newKey, ValueTypeParameter newValue) |
void | remove (KeyTypeParameter keyToRemove) |
void | removeValue (ValueTypeParameter valueToRemove) |
void | remapTable (int newNumberOfSlots) |
int | getNumSlots () const noexcept |
template<class OtherHashMapType > | |
void | swapWith (OtherHashMapType &otherHashMap) noexcept |
const TypeOfCriticalSectionToUse & | getLock () const noexcept |
Iterator | begin () const noexcept |
Iterator | end () const noexcept |
Holds a set of mappings between some key/value pairs.
The types of the key and value objects are set as template parameters. You can also specify a class to supply a hash function that converts a key value into an hashed integer. This class must have the form:
Like the Array class, the key and value types are expected to be copy-by-value types, so if you define them to be pointer types, this class won't delete the objects that they point to.
If you don't supply a class for the HashFunctionType template parameter, the default one provides some simple mappings for strings and ints.
HashFunctionType | The class of hash function, which must be copy-constructible. |
Definition at line 103 of file juce_HashMap.h.
using juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType |
Returns the type of scoped lock to use for locking this array
Definition at line 357 of file juce_HashMap.h.
|
inlineexplicit |
Creates an empty hash-map.
numberOfSlots | Specifies the number of hash entries the map will use. This will be the "upperLimit" parameter that is passed to your generateHash() function. The number of hash slots will grow automatically if necessary, or it can be remapped manually using remapTable(). |
hashFunction | An instance of HashFunctionType, which will be copied and stored to use with the HashMap. This parameter can be omitted if HashFunctionType has a default constructor. |
Definition at line 121 of file juce_HashMap.h.
|
inline |
Destructor.
Definition at line 129 of file juce_HashMap.h.
|
inlinenoexcept |
Returns a start iterator for the values in this tree.
Definition at line 470 of file juce_HashMap.h.
|
inline |
Removes all values from the map. Note that this will clear the content, but won't affect the number of slots (see remapTable and getNumSlots).
Definition at line 139 of file juce_HashMap.h.
Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::~HashMap().
|
inline |
Returns true if the map contains an item with the specified key.
Definition at line 207 of file juce_HashMap.h.
|
inline |
Returns true if the hash contains at least one occurrence of a given value.
Definition at line 215 of file juce_HashMap.h.
|
inlinenoexcept |
Returns an end iterator for the values in this tree.
Definition at line 473 of file juce_HashMap.h.
|
inlinenoexcept |
Returns the CriticalSection that locks this structure. To lock, you can call getLock().enter() and getLock().exit(), or preferably use an object of ScopedLockType as an RAII lock for it.
Definition at line 354 of file juce_HashMap.h.
Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::clear(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::contains(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::containsValue(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getReference(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::operator[](), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remapTable(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remove(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::removeValue(), and juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::swapWith().
|
inlinenoexcept |
Returns the number of slots which are available for hashing. Each slot corresponds to a single hash-code, and each one can contain multiple items.
Definition at line 332 of file juce_HashMap.h.
Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::containsValue(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getReference(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remapTable(), juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::remove(), and juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::removeValue().
|
inline |
Returns a reference to the value corresponding to a given key. If the map doesn't contain the key, a default instance of the value type is added to the map and a reference to this is returned.
keyToLookFor | the key of the item being requested |
Definition at line 185 of file juce_HashMap.h.
Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::set().
|
inline |
Returns the value corresponding to a given key. If the map doesn't contain the key, a default instance of the value type is returned.
keyToLookFor | the key of the item being requested |
Definition at line 170 of file juce_HashMap.h.
|
inline |
Remaps the hash-map to use a different number of slots for its hash function. Each slot corresponds to a single hash-code, and each one can contain multiple items.
Definition at line 303 of file juce_HashMap.h.
Referenced by juce::HashMap< KeyType, ValueType, HashFunctionType, TypeOfCriticalSectionToUse >::getReference().
|
inline |
Removes an item with the given key.
Definition at line 235 of file juce_HashMap.h.
|
inline |
Removes all items with the given value.
Definition at line 266 of file juce_HashMap.h.
|
inline |
Adds or replaces an element in the hash-map. If there's already an item with the given key, this will replace its value. Otherwise, a new item will be added to the map.
Definition at line 232 of file juce_HashMap.h.
|
inlinenoexcept |
Returns the current number of items in the map.
Definition at line 161 of file juce_HashMap.h.
|
inlinenoexcept |
Efficiently swaps the contents of two hash-maps.
Definition at line 340 of file juce_HashMap.h.