|
ATLAS Offline Software
|
Go to the documentation of this file.
17 #include <unordered_map>
38 const std::string&
str,
59 typedef std::pair<StringPool::sgaux_t, std::string>
pair_t;
74 const std::string&
str,
83 else if (
i->second.first != aux ||
i->second.second !=
str) {
102 StringPoolImpl::keymap_t::const_iterator
i =
m_keymap.find (
key);
104 aux =
i->second.first;
105 return &
i->second.second;
134 std::vector<StringPool::sgkey_t>
keys;
136 for (
const keymap_t::value_type&
p :
m_keymap)
137 keys.push_back (
p.first);
138 std::sort (
keys.begin(),
keys.end());
141 std::cout << std::hex << std::setw(18) <<
k <<
" "
142 << std::dec << std::setw(9) <<
it->second.first <<
" "
143 <<
it->second.second <<
"\n";
158 for (
const keymap_t::value_type&
p :
other.m_keymap) {
195 : m_impl (std::move (
other.m_impl))
199 other.m_impl = std::make_unique<StringPoolImpl>();
209 if (
this != &
other) {
222 if (
this != &
other) {
224 *
m_impl = std::move (other_impl);
262 while (!
m_impl->registerKey (new_key,
str, aux)) {
264 if (
key == new_key) std::abort();
272 if (!old_str) std::abort();
320 const std::string&
str,
size_t size() const
Number of registered mappings.
JetConstituentVector::iterator iterator
bool isTransientKey(const std::string &key)
Test to see if a key is transoent.
std::unique_ptr< StringPoolImpl > m_impl
std::pair< StringPool::sgaux_t, std::string > pair_t
void clear()
Empty the pool.
static const sgkey_t sgkey_t_max
size_t size() const
Number of registered mappings.
void dump() const
Debugging dump. Write to stdout.
bool merge(const StringPoolImpl &other)
Merge other pool into this one.
Maintain a mapping of strings to 64-bit ints.
uint64_t crc64addint(uint64_t crc, uint64_t x)
Extend a previously-calculated CRC to include an int.
Exception — sgkey hash collision.
unsigned int sgaux_t
Type of auxiliary data.
uint32_t sgkey_t
Type of the integer keys.
const std::string * keyToString(sgkey_t key) const
Find the string corresponding to a given key.
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
const std::string * keyToString(StringPool::sgkey_t key, StringPool::sgaux_t &aux) const
Find the string corresponding to a given key.
bool registerKey(StringPool::sgkey_t key, const std::string &str, StringPool::sgaux_t aux)
Remember an additional mapping from key to string.
void dump() const
Debugging dump.
SG::SGKeyMap< pair_t > keymap_t
std::unordered_map< sgkey_t, T > SGKeyMap
A map using sgkey_t as a key.
bool merge(const StringPool &other)
Merge another pool into this one.
A crc-64 implementation, using pclmul where possible.
sgkey_t stringToKey(const std::string &str, sgaux_t aux=0)
Find the key for a string.
bool registerKey(sgkey_t key, const std::string &str, sgaux_t aux=0)
Remember an additional mapping from key to string.
StringPool & operator=(const StringPool &other)
Assignment/move operators.