ATLAS Offline Software
|
Container for the tool constants managed by ToolWithConstants
.
More...
#include <ToolConstants.h>
Public Types | |
typedef std::map< std::string, CxxUtils::Arrayrep > | Maptype |
Type of the map from keys to values. More... | |
Public Member Functions | |
ToolConstants () | |
Default constructor. More... | |
const CxxUtils::Arrayrep & | newrep (const std::string &context, const std::string &key, const std::string &val) |
Make a new entry. More... | |
const CxxUtils::Arrayrep & | getrep (const std::string &context, const std::string &key) const |
Look up an entry. More... | |
void | setrep (const std::string &key, const CxxUtils::Arrayrep &rep) |
Set an entry. More... | |
void | setrep (const std::string &key, CxxUtils::Arrayrep &&rep) |
Set an entry. More... | |
bool | hasrep (const std::string &key) const |
Test to see if a given key is present. More... | |
void | writeConstants (std::ostream &stream, const std::string &name) const |
Writes out constants in a python-like format. More... | |
std::string | toString (const std::string &name) const |
Return the data as a formatted string. More... | |
const std::string & | clsname () const |
Return the name of the C++ class that operates on these constants. More... | |
void | clsname (const std::string &name) |
Set the name of the C++ class that operates on these constants. More... | |
int | version () const |
Return the version of the C++ class that operates on these constants. More... | |
void | version (int version) |
Set the version of the C++ class that operates on these constants. More... | |
const Maptype & | map () const |
Return the key -> value map. More... | |
Static Private Member Functions | |
static void | error (const std::string &context, const std::string &key, const std::string &msg) |
Report an error. More... | |
Private Attributes | |
Maptype | m_map |
The map of keys to values. More... | |
std::string | m_clsname |
Name of the C++ class that operates on these constants. More... | |
int | m_version |
Version number of the C++ class that operates on these constants. More... | |
Container for the tool constants managed by ToolWithConstants
.
This is just a simple map from constant name to Arrayrep
.
Definition at line 31 of file ToolConstants.h.
typedef std::map<std::string, CxxUtils::Arrayrep> CaloRec::ToolConstants::Maptype |
Type of the map from keys to values.
Definition at line 35 of file ToolConstants.h.
CaloRec::ToolConstants::ToolConstants | ( | ) |
const std::string & CaloRec::ToolConstants::clsname | ( | ) | const |
Return the name of the C++ class that operates on these constants.
Definition at line 152 of file ToolConstants.cxx.
void CaloRec::ToolConstants::clsname | ( | const std::string & | name | ) |
Set the name of the C++ class that operates on these constants.
Definition at line 161 of file ToolConstants.cxx.
|
staticprivate |
Report an error.
context | Context string for the error. |
key | Key involved in the error. |
msg | Error message. |
Definition at line 114 of file ToolConstants.cxx.
const CxxUtils::Arrayrep & CaloRec::ToolConstants::getrep | ( | const std::string & | context, |
const std::string & | key | ||
) | const |
Look up an entry.
context | The context name, for error reporting. |
key | The key of the new entry. |
Looks up key and returns its Arrayrep
. Raises an exception if key isn't found.
Definition at line 59 of file ToolConstants.cxx.
bool CaloRec::ToolConstants::hasrep | ( | const std::string & | key | ) | const |
Test to see if a given key is present.
Definition at line 101 of file ToolConstants.cxx.
const ToolConstants::Maptype & CaloRec::ToolConstants::map | ( | ) | const |
Return the key -> value map.
Definition at line 188 of file ToolConstants.cxx.
const CxxUtils::Arrayrep & CaloRec::ToolConstants::newrep | ( | const std::string & | context, |
const std::string & | key, | ||
const std::string & | val | ||
) |
Make a new entry.
context | The context name, for error reporting. |
key | The key of the new entry. |
val | The value of the new entry, as a string. |
Converts val to an Arrayrep
and stores it. Raises an exception if the key already exists or if there's a conversion error.
Definition at line 40 of file ToolConstants.cxx.
void CaloRec::ToolConstants::setrep | ( | const std::string & | key, |
const CxxUtils::Arrayrep & | rep | ||
) |
Set an entry.
key | The key of the entry to set. |
rep | The value of the new entry. |
Definition at line 79 of file ToolConstants.cxx.
void CaloRec::ToolConstants::setrep | ( | const std::string & | key, |
CxxUtils::Arrayrep && | rep | ||
) |
Set an entry.
key | The key of the entry to set. |
rep | The value of the new entry. |
Definition at line 91 of file ToolConstants.cxx.
std::string CaloRec::ToolConstants::toString | ( | const std::string & | name | ) | const |
Return the data as a formatted string.
name | Name of the Maker-Algorithm. |
Definition at line 141 of file ToolConstants.cxx.
int CaloRec::ToolConstants::version | ( | ) | const |
Return the version of the C++ class that operates on these constants.
Definition at line 170 of file ToolConstants.cxx.
void CaloRec::ToolConstants::version | ( | int | version | ) |
Set the version of the C++ class that operates on these constants.
Definition at line 179 of file ToolConstants.cxx.
void CaloRec::ToolConstants::writeConstants | ( | std::ostream & | stream, |
const std::string & | name | ||
) | const |
Writes out constants in a python-like format.
stream | Stream to which to write (file or cout) |
name | Name of the Maker-Algorithm (used only for output) |
stream | Stream to wirte to (file or cout) |
name | Name of the Maker-Algorithm (used only for output) |
Definition at line 126 of file ToolConstants.cxx.
|
private |
Name of the C++ class that operates on these constants.
Definition at line 151 of file ToolConstants.h.
|
private |
The map of keys to values.
Definition at line 148 of file ToolConstants.h.
|
private |
Version number of the C++ class that operates on these constants.
Definition at line 154 of file ToolConstants.h.