rippled
ripple
basics
UnorderedContainers.h
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of rippled: https://github.com/ripple/rippled
4
Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#ifndef RIPPLE_BASICS_UNORDEREDCONTAINERS_H_INCLUDED
21
#define RIPPLE_BASICS_UNORDEREDCONTAINERS_H_INCLUDED
22
23
#include <ripple/basics/hardened_hash.h>
24
#include <ripple/basics/partitioned_unordered_map.h>
25
#include <ripple/beast/hash/hash_append.h>
26
#include <ripple/beast/hash/uhash.h>
27
#include <ripple/beast/hash/xxhasher.h>
28
#include <
unordered_map
>
29
#include <
unordered_set
>
30
43
namespace
ripple
{
44
45
// hash containers
46
47
template
<
48
class
Key,
49
class
Value,
50
class
Hash =
beast::uhash<>
,
51
class
Pred =
std::equal_to<Key>
,
52
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
53
using
hash_map
=
std::unordered_map<Key, Value, Hash, Pred, Allocator>
;
54
55
template
<
56
class
Key,
57
class
Value,
58
class
Hash =
beast::uhash<>
,
59
class
Pred =
std::equal_to<Key>
,
60
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
61
using
hash_multimap
=
62
std::unordered_multimap<Key, Value, Hash, Pred, Allocator>
;
63
64
template
<
65
class
Value,
66
class
Hash =
beast::uhash<>
,
67
class
Pred =
std::equal_to<Value>
,
68
class
Allocator =
std::allocator<Value>
>
69
using
hash_set
=
std::unordered_set<Value, Hash, Pred, Allocator>
;
70
71
template
<
72
class
Value,
73
class
Hash =
beast::uhash<>
,
74
class
Pred =
std::equal_to<Value>
,
75
class
Allocator =
std::allocator<Value>
>
76
using
hash_multiset
=
std::unordered_multiset<Value, Hash, Pred, Allocator>
;
77
78
// hardened_hash containers
79
80
using
strong_hash
=
beast::xxhasher
;
81
82
template
<
83
class
Key,
84
class
Value,
85
class
Hash =
hardened_hash<strong_hash>
,
86
class
Pred =
std::equal_to<Key>
,
87
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
88
using
hardened_hash_map
=
std::unordered_map<Key, Value, Hash, Pred, Allocator>
;
89
90
template
<
91
class
Key,
92
class
Value,
93
class
Hash =
hardened_hash<strong_hash>
,
94
class
Pred =
std::equal_to<Key>
,
95
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
96
using
hardened_partitioned_hash_map
=
97
partitioned_unordered_map<Key, Value, Hash, Pred, Allocator>
;
98
99
template
<
100
class
Key,
101
class
Value,
102
class
Hash =
hardened_hash<strong_hash>
,
103
class
Pred =
std::equal_to<Key>
,
104
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
105
using
hardened_hash_multimap
=
106
std::unordered_multimap<Key, Value, Hash, Pred, Allocator>
;
107
108
template
<
109
class
Value,
110
class
Hash =
hardened_hash<strong_hash>
,
111
class
Pred =
std::equal_to<Value>
,
112
class
Allocator =
std::allocator<Value>
>
113
using
hardened_hash_set
=
std::unordered_set<Value, Hash, Pred, Allocator>
;
114
115
template
<
116
class
Value,
117
class
Hash =
hardened_hash<strong_hash>
,
118
class
Pred =
std::equal_to<Value>
,
119
class
Allocator =
std::allocator<Value>
>
120
using
hardened_hash_multiset
=
121
std::unordered_multiset<Value, Hash, Pred, Allocator>
;
122
123
}
// namespace ripple
124
125
#endif
unordered_set
beast::xxhasher
Definition:
xxhasher.h:30
ripple::partitioned_unordered_map
Definition:
partitioned_unordered_map.h:43
std::unordered_multimap
STL class.
ripple::hardened_hash
Seed functor once per construction.
Definition:
hardened_hash.h:96
std::unordered_multiset
STL class.
std::equal_to
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition:
RCLCensorshipDetector.h:29
std::allocator
STL class.
beast::uhash<>
unordered_map
Generated by
1.8.17