ATLAS Offline Software
ToolConstants.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-2021 CERN for the benefit of the ATLAS collaboration
4 */
13 #ifndef CALOREC_TOOLCONSTANTS_H
14 #define CALOREC_TOOLCONSTANTS_H
15 
16 
17 #include "AthenaKernel/CLASS_DEF.h"
18 #include "CxxUtils/Array.h"
19 #include <string>
20 #include <map>
21 
22 namespace CaloRec {
23 
24 
32 {
33 public:
35  typedef std::map<std::string, CxxUtils::Arrayrep> Maptype;
36 
38  ToolConstants();
39 
40 
51  const CxxUtils::Arrayrep& newrep (const std::string& context,
52  const std::string& key,
53  const std::string& val);
54 
63  const CxxUtils::Arrayrep& getrep (const std::string& context,
64  const std::string& key) const;
65 
66 
72  void setrep (const std::string& key,
73  const CxxUtils::Arrayrep& rep);
74 
75 
81  void setrep (const std::string& key,
83 
84 
88  bool hasrep (const std::string& key) const;
89 
90 
96  void writeConstants(std::ostream& stream, const std::string& name) const;
97 
98 
103  std::string toString (const std::string& name) const;
104 
105 
109  const std::string& clsname() const;
110 
111 
115  void clsname (const std::string& name);
116 
117 
122  int version() const;
123 
124 
128  void version (int version);
129 
130 
132  const Maptype& map() const;
133 
134 
135 private:
142  [[noreturn]]
143  static void error (const std::string& context,
144  const std::string& key,
145  const std::string& msg);
146 
149 
151  std::string m_clsname;
152 
155 };
156 
157 
158 } // namespace CaloRec
159 
160 
161 CLASS_DEF(CaloRec::ToolConstants,250904980 ,1)
162 
163 #include "AthenaKernel/CondCont.h"
165 
166 #endif // not CALOREC_TOOLCONSTANTS_H
CONDCONT_DEF
CONDCONT_DEF(CaloRec::ToolConstants, 274098)
CaloRec::ToolConstants::m_clsname
std::string m_clsname
Name of the C++ class that operates on these constants.
Definition: ToolConstants.h:151
CaloRec::ToolConstants::writeConstants
void writeConstants(std::ostream &stream, const std::string &name) const
Writes out constants in a python-like format.
Definition: ToolConstants.cxx:126
CaloRec::ToolConstants::version
int version() const
Return the version of the C++ class that operates on these constants.
Definition: ToolConstants.cxx:170
CaloRec::ToolConstants::ToolConstants
ToolConstants()
Default constructor.
Definition: ToolConstants.cxx:23
make_hlt_rep.rep
rep
Definition: make_hlt_rep.py:32
CaloRec::ToolConstants::m_version
int m_version
Version number of the C++ class that operates on these constants.
Definition: ToolConstants.h:154
CaloRec::ToolConstants::error
static void error(const std::string &context, const std::string &key, const std::string &msg)
Report an error.
Definition: ToolConstants.cxx:114
CaloRec::ToolConstants::hasrep
bool hasrep(const std::string &key) const
Test to see if a given key is present.
Definition: ToolConstants.cxx:101
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
CaloRec::ToolConstants::toString
std::string toString(const std::string &name) const
Return the data as a formatted string.
Definition: ToolConstants.cxx:141
CaloRec::ToolConstants::Maptype
std::map< std::string, CxxUtils::Arrayrep > Maptype
Type of the map from keys to values.
Definition: ToolConstants.h:35
CaloRec::ToolConstants::map
const Maptype & map() const
Return the key -> value map.
Definition: ToolConstants.cxx:188
Array.h
Simple multidimensional arrays.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CaloRec
Namespace for helper functions.
Definition: CaloCellFactor.h:22
CaloRec::ToolConstants::newrep
const CxxUtils::Arrayrep & newrep(const std::string &context, const std::string &key, const std::string &val)
Make a new entry.
Definition: ToolConstants.cxx:40
CaloRec::ToolConstants::m_map
Maptype m_map
The map of keys to values.
Definition: ToolConstants.h:148
CaloRec::ToolConstants
Container for the tool constants managed by ToolWithConstants.
Definition: ToolConstants.h:32
CaloRec::ToolConstants::setrep
void setrep(const std::string &key, const CxxUtils::Arrayrep &rep)
Set an entry.
Definition: ToolConstants.cxx:79
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
CaloRec::Arrayrep
Representation class for Array's.
Definition: Control/CxxUtils/CxxUtils/Arrayrep.h:62
CLASS_DEF.h
macros to associate a CLID to a type
CaloRec::ToolConstants::getrep
const CxxUtils::Arrayrep & getrep(const std::string &context, const std::string &key) const
Look up an entry.
Definition: ToolConstants.cxx:59
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
CaloRec::ToolConstants::clsname
const std::string & clsname() const
Return the name of the C++ class that operates on these constants.
Definition: ToolConstants.cxx:152