|
Ponca
4d2a58fa5c6375adef5c4b208f4d47e016cecd6d
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, OFFSET >:Public Member Functions | |
| void | clear () |
| Empty the array. | |
| std::pair< typename Self::iterator, bool > | insert (const T &_value) |
| Tries to insert a value in the HashSet. | |
| bool | contains (T _value) const |
| Tries to find a value in the HashSet. | |
| Self::const_iterator | cbegin () const |
| The beginning of the internal array. | |
| Self::const_iterator | cend () const |
| The end of the internal array. | |
| Self::iterator | begin () |
| The beginning of the internal array. | |
| Self::iterator | end () |
| The end of the internal array. | |
Protected Member Functions | |
| bool | search (T _value, T &_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) |
| OFFSET | Offsets the value stored in m_data, to avoid mistaking it with 0 the is empty flag |
The beginning of the internal array.
Definition at line 24 of file hashset.hpp.
|
inline |
The beginning of the internal array.
Definition at line 12 of file hashset.hpp.
|
inline |
The end of the internal array.
Definition at line 18 of file hashset.hpp.
| void Ponca::HashSet< N, T, HF, OFFSET >::clear | ( | ) |
Empty the array.
Iterates over every element and sets their values to 0
Definition at line 37 of file hashset.hpp.
| bool Ponca::HashSet< N, T, HF, OFFSET >::contains | ( | T | _value | ) | const |
Tries to find a value in the HashSet.
| _value | The value to search for |
Definition at line 91 of file hashset.hpp.
The end of the internal array.
Definition at line 30 of file hashset.hpp.
| std::pair< typename HashSet< N, T, HF, OFFSET >::iterator, bool > Ponca::HashSet< N, T, HF, OFFSET >::insert | ( | const T & | _value | ) |
Tries to insert a value in the HashSet.
| _value | The value to be inserted in the HashSet |
Definition at line 70 of file hashset.hpp.
|
inlineprotected |
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. |
Definition at line 43 of file hashset.hpp.