CMS 3D CMS Logo

ConfObject.h
Go to the documentation of this file.
1 #ifndef ConfObject_h
2 #define ConfObject_h
3 
5 
6 #include <iostream>
7 #include <vector>
8 #include <map>
9 #include <algorithm>
10 #include <iterator>
11 #include <sstream>
12 
14 
29 class ConfObject {
30 public:
32 
33  template <class valueType>
34  bool put(const std::string& name, const valueType& inputValue) {
35  std::stringstream ss;
36  ss << inputValue;
37  if (parameters.insert(std::make_pair(name, ss.str())).second)
38  return true;
39  return false;
40  }
41 
42  template <class valueType>
43  valueType get(const std::string& name) const {
44  valueType returnValue;
45  parMap::const_iterator it = parameters.find(name);
46  std::stringstream ss;
47  if (it != parameters.end()) {
48  ss << it->second;
49  ss >> returnValue;
50  } else {
51  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
52  }
53  return returnValue;
54  }
55 
56  bool isParameter(const std::string& name) const { return (parameters.find(name) != parameters.end()); }
57 
59  void printSummary(std::stringstream& ss) const;
61  void printDebug(std::stringstream& ss) const;
62 
63  typedef std::map<std::string, std::string> parMap;
64 
66 
68 };
69 
70 #endif
ConfObject::ConfObject
ConfObject()
Definition: ConfObject.h:31
MessageLogger.h
ConfObject::printDebug
void printDebug(std::stringstream &ss) const
Prints the full list of parameters.
Definition: ConfObject.cc:10
gather_cfg.cout
cout
Definition: gather_cfg.py:144
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
ConfObject::parMap
std::map< std::string, std::string > parMap
Definition: ConfObject.h:63
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
ConfObject::isParameter
bool isParameter(const std::string &name) const
Definition: ConfObject.h:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ConfObject::printSummary
void printSummary(std::stringstream &ss) const
Prints the full list of parameters.
Definition: ConfObject.cc:3
Serializable.h
ConfObject
Definition: ConfObject.h:29
ConfObject::get
valueType get(const std::string &name) const
Definition: ConfObject.h:43
ConfObject::put
bool put(const std::string &name, const valueType &inputValue)
Definition: ConfObject.h:34
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ConfObject::parameters
parMap parameters
Definition: ConfObject.h:65