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/beast/hash/hash_append.h>
25
#include <ripple/beast/hash/uhash.h>
26
#include <ripple/beast/hash/xxhasher.h>
27
#include <
unordered_map
>
28
#include <
unordered_set
>
29
42
namespace
ripple
{
43
44
// hash containers
45
46
template
<
47
class
Key,
48
class
Value,
49
class
Hash =
beast::uhash<>
,
50
class
Pred =
std::equal_to<Key>
,
51
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
52
using
hash_map
=
std::unordered_map<Key, Value, Hash, Pred, Allocator>
;
53
54
template
<
55
class
Key,
56
class
Value,
57
class
Hash =
beast::uhash<>
,
58
class
Pred =
std::equal_to<Key>
,
59
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
60
using
hash_multimap
=
61
std::unordered_multimap<Key, Value, Hash, Pred, Allocator>
;
62
63
template
<
64
class
Value,
65
class
Hash =
beast::uhash<>
,
66
class
Pred =
std::equal_to<Value>
,
67
class
Allocator =
std::allocator<Value>
>
68
using
hash_set
=
std::unordered_set<Value, Hash, Pred, Allocator>
;
69
70
template
<
71
class
Value,
72
class
Hash =
beast::uhash<>
,
73
class
Pred =
std::equal_to<Value>
,
74
class
Allocator =
std::allocator<Value>
>
75
using
hash_multiset
=
std::unordered_multiset<Value, Hash, Pred, Allocator>
;
76
77
// hardened_hash containers
78
79
using
strong_hash
=
beast::xxhasher
;
80
81
template
<
82
class
Key,
83
class
Value,
84
class
Hash =
hardened_hash<strong_hash>
,
85
class
Pred =
std::equal_to<Key>
,
86
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
87
using
hardened_hash_map
=
std::unordered_map<Key, Value, Hash, Pred, Allocator>
;
88
89
template
<
90
class
Key,
91
class
Value,
92
class
Hash =
hardened_hash<strong_hash>
,
93
class
Pred =
std::equal_to<Key>
,
94
class
Allocator =
std::allocator<std::pair<Key const, Value>
>>
95
using
hardened_hash_multimap
=
96
std::unordered_multimap<Key, Value, Hash, Pred, Allocator>
;
97
98
template
<
99
class
Value,
100
class
Hash =
hardened_hash<strong_hash>
,
101
class
Pred =
std::equal_to<Value>
,
102
class
Allocator =
std::allocator<Value>
>
103
using
hardened_hash_set
=
std::unordered_set<Value, Hash, Pred, Allocator>
;
104
105
template
<
106
class
Value,
107
class
Hash =
hardened_hash<strong_hash>
,
108
class
Pred =
std::equal_to<Value>
,
109
class
Allocator =
std::allocator<Value>
>
110
using
hardened_hash_multiset
=
111
std::unordered_multiset<Value, Hash, Pred, Allocator>
;
112
113
}
// namespace ripple
114
115
#endif
unordered_set
beast::xxhasher
Definition:
xxhasher.h:30
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