|
Ponca
911e152b8d5ac5c934a260b3832f7f62800b65b9
Point Cloud Analysis library
|
Stores unique signed integer values in a contiguous array. More...
#include <hashset.h>
Collaboration diagram for Ponca::HashSet< N, T, _HashFunctor >:Public Member Functions | |
| void | clear () |
| Empty the array. | |
| bool | insert (int _value) |
| Tries to insert a value in the HashSet. | |
| bool | contains (int _value) const |
| Tries to find a value in the HashSet. | |
Protected Member Functions | |
| bool | search (int _value, int &_searchedIdx) const |
| Search for a value in the HashSet. | |
Stores unique signed integer values in a contiguous array.
A simple HashMap implementation that mimics a set of indices, by only stores the keys in a Set-like structure (Hence the name HashSet). The internal logic of this HashMap is similar to a std::unordered_map, but is compatible with CUDA.
For the search, the best case complexity is O(1), and the worst case complexity is O(n). The complexity is entirely dependent on the hashing function, and the given values : If our hashing function produce sparser result for our set of indices, it will reduce the complexity of the searches for both the HashSet::insert and HashSet::contains method.
| N | The maximum size of the HashSet |
| T | The value type stored in the HashSet (Default to int) |
| _HashFunctor | For the hashing function (Default to HashDefaultFunctor) |
|
inlineconstexpr |
| void Ponca::HashSet< N, T, HF >::clear | ( | ) |
Empty the array.
Iterates over every element and sets their values to the EMPTY flag value (default to -1)
Definition at line 11 of file hashset.hpp.
| bool Ponca::HashSet< N, T, HF >::contains | ( | int | _value | ) | const |
Tries to find a value in the HashSet.
| _value | The value to search for |
Definition at line 63 of file hashset.hpp.
| bool Ponca::HashSet< N, T, HF >::insert | ( | int | _value | ) |
Tries to insert a value in the HashSet.
| _value | The value to be inserted in the HashSet |
Definition at line 44 of file hashset.hpp.
Search for a value in the HashSet.
Use the hashing function to check if a value is inside the internal array.
Use a reference to either output the id of the last element that was searched in the m_data array or will output -1 if the array is completely full.
| _value | The value to be inserted in the HashSet |
| _searchedIdx | Reference to the last searched index or -1 if the array is full. |
| _hash | The hashing function |
Definition at line 17 of file hashset.hpp.