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

◆ isParameter()

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

Definition at line 76 of file SiStripConfObject.h.

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

References Skims_PA_cff::name.

Referenced by StripCPE::StripCPE().

◆ 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.

115  {
116  printSummary(ss, trackerTopo);
117 }

References printSummary(), and contentValuesCheck::ss.

Referenced by APVCyclePhaseProducerFromL1TS::beginRun().

◆ 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.

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 }

References contentValuesCheck::ss.

Referenced by printDebug().

◆ put()

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

Definition at line 36 of file SiStripConfObject.h.

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  }

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

◆ 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.

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  }

References gather_cfg::cout, Skims_PA_cff::name, 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().

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.

gather_cfg.cout
cout
Definition: gather_cfg.py:144
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripConfObject::printSummary
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints the full list of parameters.
Definition: SiStripConfObject.cc:108
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17