forked from HeliumProject/Foundation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ConcurrentHashSet.h
57 lines (48 loc) · 1.88 KB
/
ConcurrentHashSet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include "Foundation/ConcurrentHashTable.h"
#include "Foundation/Functions.h"
#include "Foundation/HashFunctions.h"
namespace Helium
{
/// Thread-safe hash set container.
template<
typename Key,
typename HashFunction = Hash< Key >,
typename EqualKey = Equals< Key >,
typename Allocator = DefaultAllocator >
class ConcurrentHashSet
: public ConcurrentHashTable< const Key, const Key, HashFunction, Identity< const Key >, EqualKey, Allocator, Key >
{
public:
/// Default hash table bucket count (prime numbers are recommended).
static const size_t DEFAULT_BUCKET_COUNT = 37;
/// Parent class type.
typedef ConcurrentHashTable< const Key, const Key, HashFunction, Identity< const Key >, EqualKey, Allocator, Key >
Base;
/// Type for hash set keys.
typedef typename Base::KeyType KeyType;
/// Type for hash set entries.
typedef typename Base::ValueType ValueType;
/// Type for key hashing function.
typedef typename Base::HasherType HasherType;
/// Type for testing two keys for equality.
typedef typename Base::KeyEqualType KeyEqualType;
/// Allocator type.
typedef typename Base::AllocatorType AllocatorType;
/// Accessor type.
typedef typename Base::Accessor Accessor;
/// Constant accessor type.
typedef typename Base::ConstAccessor ConstAccessor;
/// @name Construction/Destruction
//@{
explicit ConcurrentHashSet( size_t bucketCount = DEFAULT_BUCKET_COUNT );
ConcurrentHashSet( const ConcurrentHashSet& rSource );
~ConcurrentHashSet();
//@}
/// @name Overloaded Operators
//@{
ConcurrentHashSet& operator=( const ConcurrentHashSet& rSource );
//@}
};
}
#include "Foundation/ConcurrentHashSet.inl"