CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripConfObject.h
Go to the documentation of this file.
1 #ifndef SiStripConfObject_h
2 #define SiStripConfObject_h
3 
4 #include <iostream>
5 #include <vector>
6 #include <map>
7 #include <algorithm>
8 #include <iterator>
9 #include <sstream>
10 
12 
28 {
29  public:
31 
32  template <class valueType>
33  bool put( const std::string & name, const valueType & inputValue )
34  {
35  std::stringstream ss;
36  ss << inputValue;
37  if( parameters.insert(std::make_pair(name, ss.str())).second ) return true;
38  return false;
39  }
40 
41  template <class valueType>
42  valueType get( const std::string & name ) const
43  {
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  }
51  else {
52  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
53  }
54  return returnValue;
55  }
56 
57  bool isParameter( const std::string & name ) const
58  {
59  return( parameters.find(name) != parameters.end() );
60  }
61 
63  void printSummary(std::stringstream & ss) const;
65  void printDebug(std::stringstream & ss) const;
66 
67  typedef std::map<std::string, std::string> parMap;
68 
70 };
71 
72 #endif
void printSummary(std::stringstream &ss) const
Prints the full list of parameters.
std::map< std::string, std::string > parMap
bool put(const std::string &name, const valueType &inputValue)
void printDebug(std::stringstream &ss) const
Prints the full list of parameters.
tuple cout
Definition: gather_cfg.py:121
bool isParameter(const std::string &name) const