![]() |
Murl Engine API
Version 2025.1
|
A hash class. More...
#include <murl_hash.h>
A hash class.
The hash class stores indices accessible by a hash value.
This class is based on the NTL Hash container, see http://www.ultimatepp.org
Public Member Functions | |
| Hash () | |
| The default constructor. More... | |
| Hash (const Hash &hash) | |
| The copy constructor. More... | |
| Hash & | operator= (const Hash &hash) |
| The assignment operator. More... | |
| Hash (Hash &&hash) noexcept | |
| The move constructor. More... | |
| Hash & | operator= (Hash &&hash) noexcept |
| The move operator. More... | |
| ~Hash () | |
| The destructor. | |
| void | Clear () |
| Clear the hash object. | |
| void | ClearIndex () |
| Clear the index. | |
| void | Reindex (SInt32 n) |
| Clear and rebuild the index for a given number of items. More... | |
| void | Reindex () |
| Clear and rebuild the index. | |
| void | Shrink () |
| Shrink the hash object so that the underlying storage is only as large as necessary. | |
| Bool | Trim (SInt32 n) |
| Reduce the hash object to a given number of items. More... | |
| Bool | Drop (SInt32 n) |
| Reduce the hash object by removing a given number of items from the end. More... | |
| void | Reserve (SInt32 n) |
| Reserve storage space. More... | |
| Bool | Unlink (SInt32 index) |
| Unlink a given index. More... | |
| Bool | IsUnlinked (SInt32 index) const |
| Check if the given index is unlinked. More... | |
| Bool | HasUnlinked () const |
| Check if the hash has unlinked entries. More... | |
| SInt32Array | GetUnlinked () const |
| Get an array of unlinked indices. More... | |
| void | Set (SInt32 index, UInt32 hash) |
| Replace the index for a specified hash value. More... | |
| void | SetUn (SInt32 index, UInt32 hash) |
| Replace the hash value at a specified index without consideration of multiple entries per hash value. More... | |
| void | Add (UInt32 hash) |
| Add a hash value. More... | |
| SInt32 | Put (UInt32 hash) |
| Put a hash value by replacing an unlinked index if present. More... | |
| void | Insert (SInt32 index, UInt32 hash) |
| Insert an index for a given hash value. More... | |
| void | Remove (SInt32 index) |
| Remove the hash value at a given position. More... | |
| void | Remove (SInt32 index, SInt32 count) |
| Remove a number of hash values at a given starting position. More... | |
| void | Remove (const SInt32 *sortedIndices, SInt32 count) |
| Remove a number of hash values at given positions. More... | |
| SInt32 | Find (UInt32 hash) const |
| Find the first index of a given hash value. More... | |
| SInt32 | FindNext (SInt32 index) const |
| Find the next occurrence of a hash value that is specified by a given index. More... | |
| SInt32 | FindPrev (SInt32 index) const |
| Find the previous occurrence of a hash value that is specified by a given index. More... | |
| SInt32 | FindLast (UInt32 hash) const |
| Find the last occurrence of a hash value. More... | |
| UInt32 | operator[] (SInt32 index) const |
| Get the hash value for a given index. More... | |
| SInt32 | GetCount () const |
| Get the number of items. More... | |
| void | Swap (Hash &other) |
| Exchange the content of the hash object with a given second one. More... | |
| Murl::Hash::Hash | ( | ) |
The default constructor.
Create an empty hash object.
| Murl::Hash::Hash | ( | const Hash & | hash | ) |
The copy constructor.
| hash | The hash object to copy. |
|
noexcept |
The move constructor.
| hash | The hash object to move. |
The assignment operator.
| hash | The hash object to copy. |
The move operator.
| hash | The hash object to move. |
| void Murl::Hash::Reindex | ( | SInt32 | n | ) |
Clear and rebuild the index for a given number of items.
| n | The number of items to rebuild. |
Reduce the hash object to a given number of items.
| n | The new number of items in the hash object, must be smaller than the current item count. |
Reduce the hash object by removing a given number of items from the end.
| n | The number of items to remove from the end. |
| void Murl::Hash::Reserve | ( | SInt32 | n | ) |
Reserve storage space.
If the given size is less than the actual size, nothing is done.
| n | The number of items the underlying storage should hold. |
Unlink a given index.
Unlinked items remain in the hash object, but are ignored by any search operations.
| index | The index to unlink. |
Check if the given index is unlinked.
| index | The index to check. |
| Bool Murl::Hash::HasUnlinked | ( | ) | const |
Check if the hash has unlinked entries.
| SInt32Array Murl::Hash::GetUnlinked | ( | ) | const |
Get an array of unlinked indices.
Replace the index for a specified hash value.
| index | The index to set. |
| hash | The hash value to set. |
Replace the hash value at a specified index without consideration of multiple entries per hash value.
| index | The index to set. |
| hash | The hash value to set. |
| void Murl::Hash::Add | ( | UInt32 | hash | ) |
Add a hash value.
| hash | The hash value to add. |
Put a hash value by replacing an unlinked index if present.
| hash | The hash value to add. |
Insert an index for a given hash value.
| index | The index to insert. |
| hash | The hash value to insert. |
| void Murl::Hash::Remove | ( | SInt32 | index | ) |
Remove the hash value at a given position.
| index | The index from where to remove the hash value. |
Remove a number of hash values at a given starting position.
| index | The index from where to start removing the hash values. |
| count | The number of subsequent hash values to remove. |
Remove a number of hash values at given positions.
| sortedIndices | A pointer to sorted indices where to remove the hash values. |
| count | The number of hash values to remove, i.e. the number of indices. |
Find the first index of a given hash value.
| hash | The hash value to search for. |
Find the next occurrence of a hash value that is specified by a given index.
| index | The index of the hash value to search for. |
Find the previous occurrence of a hash value that is specified by a given index.
| index | The index of the hash value to search for. |
Find the last occurrence of a hash value.
| hash | The hash value to search for. |
Get the hash value for a given index.
If the index is out of range, the behaviour is undefined.
| index | The index of the hash value to retrieve. |
| SInt32 Murl::Hash::GetCount | ( | ) | const |
Get the number of items.
| void Murl::Hash::Swap | ( | Hash & | other | ) |
Exchange the content of the hash object with a given second one.
| other | The second hash object. |