CMS 3D CMS Logo

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

#include <SiStripConfObject.h>

Public Types

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

Public Member Functions

template<class valueType >
valueType get (const std::string &name) const
 
bool isParameter (const std::string &name) const
 
void printDebug (std::stringstream &ss, const TrackerTopology *trackerTopo) const
 Prints the full list of parameters. More...
 
void printSummary (std::stringstream &ss, const TrackerTopology *trackerTopo) const
 Prints the full list of parameters. More...
 
template<class valueType >
bool put (const std::string &name, const valueType &inputValue)
 
 SiStripConfObject ()
 
template<class valueType >
bool update (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 31 of file SiStripConfObject.h.

Member Typedef Documentation

◆ parMap

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

Definition at line 83 of file SiStripConfObject.h.

Constructor & Destructor Documentation

◆ SiStripConfObject()

SiStripConfObject::SiStripConfObject ( )
inline

Definition at line 33 of file SiStripConfObject.h.

33 {}

Member Function Documentation

◆ get()

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

Definition at line 63 of file SiStripConfObject.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(), StripCPE::StripCPE(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), util.rrapi.RRApi::templates(), rrapi.RRApi::templates(), rrapi.RRApi::workspaces(), and util.rrapi.RRApi::workspaces().

63  {
64  valueType returnValue = 0;
65  parMap::const_iterator it = parameters.find(name);
66  std::stringstream ss;
67  if (it != parameters.end()) {
68  ss << it->second;
69  ss >> returnValue;
70  } else {
71  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
72  }
73  return returnValue;
74  }

◆ isParameter()

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

Definition at line 76 of file SiStripConfObject.h.

References Skims_PA_cff::name, and parameters.

Referenced by StripCPE::StripCPE().

76 { return (parameters.find(name) != parameters.end()); }

◆ printDebug()

void SiStripConfObject::printDebug ( std::stringstream &  ss,
const TrackerTopology trackerTopo 
) const

Prints the full list of parameters.

Definition at line 115 of file SiStripConfObject.cc.

References printSummary(), and contentValuesCheck::ss.

115  {
116  printSummary(ss, trackerTopo);
117 }
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the full list of parameters.

◆ printSummary()

void SiStripConfObject::printSummary ( std::stringstream &  ss,
const TrackerTopology trackerTopo 
) const

Prints the full list of parameters.

Definition at line 108 of file SiStripConfObject.cc.

References parameters, and contentValuesCheck::ss.

Referenced by printDebug().

108  {
109  parMap::const_iterator it = parameters.begin();
110  for (; it != parameters.end(); ++it) {
111  ss << "parameter name = " << it->first << " value = " << it->second << std::endl;
112  }
113 }

◆ put()

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

Definition at line 36 of file SiStripConfObject.h.

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

36  {
37  std::stringstream ss;
38  ss << inputValue;
39  if (parameters.insert(std::make_pair(name, ss.str())).second)
40  return true;
41  return false;
42  }

◆ serialize()

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

◆ update()

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

Updating the value stored as 'name' with 'inputValue'. False if parameter 'name' does not exist (and nothing is done then - use put(..) instead!), otherwise true.

Definition at line 48 of file SiStripConfObject.h.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

48  {
49  parMap::iterator it = parameters.find(name);
50  if (it == parameters.end()) {
51  std::cout << "WARNING in SiStripConfObject::update: parameter " << name << " not found, "
52  << "so cannot be updated to '" << inputValue << "'." << std::endl;
53  return false;
54  } else {
55  std::stringstream ss;
56  ss << inputValue;
57  it->second = ss.str();
58  return true;
59  }
60  }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 87 of file SiStripConfObject.h.

◆ cond::serialization::access

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

Definition at line 87 of file SiStripConfObject.h.

Member Data Documentation

◆ parameters

parMap SiStripConfObject::parameters

Definition at line 85 of file SiStripConfObject.h.

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