ATLAS Offline Software
Loading...
Searching...
No Matches
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*/
11
12
13#ifndef CALOREC_TOOLCONSTANTS_H
14#define CALOREC_TOOLCONSTANTS_H
15
16
18#include "CxxUtils/Array.h"
19#include <string>
20#include <map>
21
22namespace CaloRec {
23
24
32{
33public:
35 typedef std::map<std::string, CxxUtils::Arrayrep> Maptype;
36
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,
82 CxxUtils::Arrayrep&& rep);
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
135private:
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
162
163#include "AthenaKernel/CondCont.h"
165
166#endif // not CALOREC_TOOLCONSTANTS_H
#define CONDCONT_DEF(...)
Definition CondCont.h:1413
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Simple multidimensional arrays.
Container for the tool constants managed by ToolWithConstants.
Maptype m_map
The map of keys to values.
const CxxUtils::Arrayrep & newrep(const std::string &context, const std::string &key, const std::string &val)
Make a new entry.
int m_version
Version number of the C++ class that operates on these constants.
std::map< std::string, CxxUtils::Arrayrep > Maptype
Type of the map from keys to values.
void setrep(const std::string &key, const CxxUtils::Arrayrep &rep)
Set an entry.
bool hasrep(const std::string &key) const
Test to see if a given key is present.
int version() const
Return the version of the C++ class that operates on these constants.
const CxxUtils::Arrayrep & getrep(const std::string &context, const std::string &key) const
Look up an entry.
ToolConstants()
Default constructor.
const std::string & clsname() const
Return the name of the C++ class that operates on these constants.
const Maptype & map() const
Return the key -> value map.
std::string m_clsname
Name of the C++ class that operates on these constants.
void writeConstants(std::ostream &stream, const std::string &name) const
Writes out constants in a python-like format.
std::string toString(const std::string &name) const
Return the data as a formatted string.
Namespace for helper functions.
Representation class for Array's.
MsgStream & msg
Definition testRead.cxx:32