Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
StringPool.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 */
23 #ifndef SGTOOLS_STRINGPOOL_H
24 #define SGTOOLS_STRINGPOOL_H
25 
26 #include <stdint.h>
27 #include <string>
28 #include <memory>
29 
30 namespace SG {
31 
32 class StringPoolImpl;
33 
35 {
36 public:
38  typedef uint32_t sgkey_t;
39 
41  typedef unsigned int sgaux_t;
42 
45  static const int sgkey_t_nbits = 30;
46  static const sgkey_t sgkey_t_max =
47  (static_cast<sgkey_t>(1) << sgkey_t_nbits) - 1;
48 
50  StringPool();
51 
53  ~StringPool();
54 
56  StringPool (const StringPool& other);
58 
62 
72  sgkey_t stringToKey (const std::string& str, sgaux_t aux = 0);
73 
81  const std::string* keyToString (sgkey_t key) const;
82 
91  const std::string* keyToString (sgkey_t key, sgaux_t& aux) const;
92 
104  bool registerKey (sgkey_t key,
105  const std::string& str,
106  sgaux_t aux = 0);
107 
108 
112  size_t size() const;
113 
117  void dump() const;
118 
119 
123  void clear();
124 
125 
133  bool merge (const StringPool& other);
134 
135 
136 private:
137  std::unique_ptr<StringPoolImpl> m_impl;
138 };
139 
140 
141 } // namespace SG
142 
143 
144 #endif // not SGTOOLS_STRINGPOOL_H
SG::StringPool::StringPool
StringPool()
Constructor.
Definition: StringPool.cxx:174
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::StringPool
Definition: StringPool.h:35
SG::StringPool::m_impl
std::unique_ptr< StringPoolImpl > m_impl
Definition: StringPool.h:137
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::StringPool::sgkey_t_nbits
static const int sgkey_t_nbits
Number of bits we'll use in the keys.
Definition: StringPool.h:45
SG::StringPool::clear
void clear()
Empty the pool.
Definition: StringPool.cxx:350
SG::StringPool::sgkey_t_max
static const sgkey_t sgkey_t_max
Definition: StringPool.h:46
SG::StringPool::size
size_t size() const
Number of registered mappings.
Definition: StringPool.cxx:332
SG::StringPool::sgaux_t
unsigned int sgaux_t
Type of auxiliary data.
Definition: StringPool.h:41
SG::StringPool::sgkey_t
uint32_t sgkey_t
Type of the integer keys.
Definition: StringPool.h:38
SG::StringPool::keyToString
const std::string * keyToString(sgkey_t key) const
Find the string corresponding to a given key.
Definition: StringPool.cxx:286
SG::StringPool::dump
void dump() const
Debugging dump.
Definition: StringPool.cxx:341
SG::StringPool::~StringPool
~StringPool()
Destructor.
Definition: StringPool.cxx:233
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::StringPool::merge
bool merge(const StringPool &other)
Merge another pool into this one.
Definition: StringPool.cxx:363
str
Definition: BTagTrackIpAccessor.cxx:11
SG::StringPool::stringToKey
sgkey_t stringToKey(const std::string &str, sgaux_t aux=0)
Find the key for a string.
Definition: StringPool.cxx:248
SG::StringPool::registerKey
bool registerKey(sgkey_t key, const std::string &str, sgaux_t aux=0)
Remember an additional mapping from key to string.
Definition: StringPool.cxx:319
SG::StringPool::operator=
StringPool & operator=(const StringPool &other)
Assignment/move operators.
Definition: StringPool.cxx:207
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37