CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Friends
ConfObject Class Reference

#include <ConfObject.h>

Public Types

typedef std::map< std::string, std::string > parMap
 

Public Member Functions

 ConfObject ()
 
template<class valueType >
valueType get (const std::string &name) const
 
bool isParameter (const std::string &name) const
 
void printDebug (std::stringstream &ss) const
 Prints the full list of parameters. More...
 
void printSummary (std::stringstream &ss) const
 Prints the full list of parameters. More...
 
template<class valueType >
bool put (const std::string &name, const valueType &inputValue)
 

Public Attributes

parMap parameters
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Author M. De Mattia - 16/11/2009

Simple class used to store configuration values.
It stores a map<std::string, std::string> with all the parameters and their values.
The put and get methods are provided to store and access the parameters.
The put method retuns a bool which is true if the insertion was successuful. If the parameter is already existing the insertion will not happen and the return value will be false.
The get method is templated and works like the getParameter<type> of the framework.
The isParameter method can be used to check whether a parameter exists. It will return a bool with the result.
The printSummary and printDebug method return both the full list of parameters.

Definition at line 29 of file ConfObject.h.

Member Typedef Documentation

◆ parMap

typedef std::map<std::string, std::string> ConfObject::parMap

Definition at line 63 of file ConfObject.h.

Constructor & Destructor Documentation

◆ ConfObject()

ConfObject::ConfObject ( )
inline

Definition at line 31 of file ConfObject.h.

31 {}

Member Function Documentation

◆ get()

template<class valueType >
valueType ConfObject::get ( const std::string &  name) const
inline

Definition at line 43 of file ConfObject.h.

References gather_cfg::cout, Skims_PA_cff::name, parameters, and contentValuesCheck::ss.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), rrapi.RRApi::count(), util.rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

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  } else {
51  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
52  }
53  return returnValue;
54  }
parMap parameters
Definition: ConfObject.h:65

◆ isParameter()

bool ConfObject::isParameter ( const std::string &  name) const
inline

Definition at line 56 of file ConfObject.h.

References Skims_PA_cff::name, and parameters.

56 { return (parameters.find(name) != parameters.end()); }
parMap parameters
Definition: ConfObject.h:65

◆ printDebug()

void ConfObject::printDebug ( std::stringstream &  ss) const

Prints the full list of parameters.

Definition at line 10 of file ConfObject.cc.

References printSummary(), and contentValuesCheck::ss.

10 { printSummary(ss); }
void printSummary(std::stringstream &ss) const
Prints the full list of parameters.
Definition: ConfObject.cc:3

◆ printSummary()

void ConfObject::printSummary ( std::stringstream &  ss) const

Prints the full list of parameters.

Definition at line 3 of file ConfObject.cc.

References parameters, and contentValuesCheck::ss.

Referenced by printDebug().

3  {
4  parMap::const_iterator it = parameters.begin();
5  for (; it != parameters.end(); ++it) {
6  ss << "parameter name = " << it->first << " value = " << it->second << std::endl;
7  }
8 }
parMap parameters
Definition: ConfObject.h:65

◆ put()

template<class valueType >
bool ConfObject::put ( const std::string &  name,
const valueType &  inputValue 
)
inline

Definition at line 34 of file ConfObject.h.

References Skims_PA_cff::name, parameters, and contentValuesCheck::ss.

34  {
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  }
parMap parameters
Definition: ConfObject.h:65

◆ serialize()

template<class Archive >
void ConfObject::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 67 of file ConfObject.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 67 of file ConfObject.h.

Member Data Documentation

◆ parameters

parMap ConfObject::parameters

Definition at line 65 of file ConfObject.h.

Referenced by get(), isParameter(), printSummary(), and put().