Urho3D
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
Urho3D::HashSet< T > Class Template Reference

Hash set template class. More...

#include </home/runner/work/urho3d-doxygen.github.io/urho3d-doxygen.github.io/urho3d_repo/Source/Urho3D/Container/HashSet.h>

Inheritance diagram for Urho3D::HashSet< T >:
Urho3D::HashBase

Classes

struct  ConstIterator
 Hash set node const iterator. More...
 
struct  Iterator
 Hash set node iterator. More...
 
struct  Node
 Hash set node. More...
 

Public Member Functions

 HashSet ()
 Construct empty.
 
 HashSet (const HashSet< T > &set)
 Construct from another hash set.
 
 HashSet (HashSet< T > &&set) noexcept
 Move-construct from another hash set.
 
 HashSet (const std::initializer_list< T > &list)
 Aggregate initialization constructor.
 
 ~HashSet ()
 Destruct.
 
HashSetoperator= (const HashSet< T > &rhs)
 Assign a hash set.
 
HashSetoperator= (HashSet< T > &&rhs) noexcept
 Move-assign a hash set.
 
HashSetoperator+= (const T &rhs)
 Add-assign a value.
 
HashSetoperator+= (const HashSet< T > &rhs)
 Add-assign a hash set.
 
bool operator== (const HashSet< T > &rhs) const
 Test for equality with another hash set.
 
bool operator!= (const HashSet< T > &rhs) const
 Test for inequality with another hash set.
 
Iterator Insert (const T &key)
 Insert a key. Return an iterator to it.
 
Iterator Insert (const T &key, bool &exists)
 Insert a key. Return an iterator and set exists flag according to whether the key already existed.
 
void Insert (const HashSet< T > &set)
 Insert a set.
 
Iterator Insert (const ConstIterator &it)
 Insert a key by iterator. Return iterator to the value.
 
bool Erase (const T &key)
 Erase a key. Return true if was found.
 
Iterator Erase (const Iterator &it)
 Erase a key by iterator. Return iterator to the next key.
 
void Clear ()
 Clear the set.
 
void Sort ()
 Sort keys. After sorting the set can be iterated in order until new elements are inserted.
 
bool Rehash (i32 numBuckets)
 Rehash to a specific bucket count, which must be a power of two. Return true if successful.
 
Iterator Find (const T &key)
 Return iterator to the key, or end iterator if not found.
 
ConstIterator Find (const T &key) const
 Return const iterator to the key, or end iterator if not found.
 
bool Contains (const T &key) const
 Return whether contains a key.
 
Iterator Begin ()
 Return iterator to the beginning.
 
ConstIterator Begin () const
 Return iterator to the beginning.
 
Iterator End ()
 Return iterator to the end.
 
ConstIterator End () const
 Return iterator to the end.
 
const T & Front () const
 Return first key.
 
const T & Back () const
 Return last key.
 
- Public Member Functions inherited from Urho3D::HashBase
 HashBase ()
 Construct.
 
void Swap (HashBase &rhs)
 Swap with another hash set or map.
 
i32 Size () const
 Return number of elements.
 
i32 NumBuckets () const
 Return number of buckets.
 
bool Empty () const
 Return whether has no elements.
 

Private Member Functions

NodeHead () const
 Return the head node.
 
NodeTail () const
 Return the tail node.
 
NodeFindNode (const T &key, unsigned hashKey) const
 Find a node from the buckets. Do not call if the buckets have not been allocated.
 
NodeFindNode (const T &key, unsigned hashKey, Node *&previous) const
 Find a node and the previous node from the buckets. Do not call if the buckets have not been allocated.
 
NodeInsertNode (Node *dest, const T &key)
 Insert a node into the list. Return the new node.
 
NodeEraseNode (Node *node)
 Erase a node from the list. Return pointer to the next element, or to the end if could not erase.
 
NodeReserveNode ()
 Reserve a node.
 
NodeReserveNode (const T &key)
 Reserve a node with specified key.
 
void FreeNode (Node *node)
 Free a node.
 
void Rehash ()
 Rehash the buckets.
 
hash32 Hash (const T &key) const
 Compute a hash based on the key and the bucket size.
 

Static Private Member Functions

static bool CompareNodes (Node *&lhs, Node *&rhs)
 Compare two nodes.
 

Additional Inherited Members

- Static Public Attributes inherited from Urho3D::HashBase
static constexpr i32 MIN_BUCKETS = 8
 Initial amount of buckets.
 
static constexpr i32 MAX_LOAD_FACTOR = 4
 Maximum load factor.
 
- Protected Member Functions inherited from Urho3D::HashBase
void AllocateBuckets (i32 size, i32 numBuckets)
 Allocate bucket head pointers + room for size and bucket count variables.
 
void ResetPtrs ()
 Reset bucket head pointers.
 
void SetSize (i32 size)
 Set new size.
 
HashNodeBase ** Ptrs () const
 Return bucket head pointers.
 
- Protected Attributes inherited from Urho3D::HashBase
HashNodeBasehead_
 List head node pointer.
 
HashNodeBasetail_
 List tail node pointer.
 
HashNodeBase ** ptrs_
 Bucket head pointers.
 
AllocatorBlockallocator_
 Node allocator.
 

Detailed Description

template<class T>
class Urho3D::HashSet< T >

Hash set template class.


The documentation for this class was generated from the following file: