CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 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)
 
 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 29 of file SiStripConfObject.h.

Member Typedef Documentation

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

Definition at line 89 of file SiStripConfObject.h.

Constructor & Destructor Documentation

SiStripConfObject::SiStripConfObject ( )
inline

Definition at line 32 of file SiStripConfObject.h.

32 {}

Member Function Documentation

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

Definition at line 64 of file SiStripConfObject.h.

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

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), StripCPE::StripCPE(), util.rrapi.RRApi::tables(), 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().

65  {
66  valueType returnValue = 0;
67  parMap::const_iterator it = parameters.find(name);
68  std::stringstream ss;
69  if( it != parameters.end() ) {
70  ss << it->second;
71  ss >> returnValue;
72  }
73  else {
74  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
75  }
76  return returnValue;
77  }
tuple cout
Definition: gather_cfg.py:145
bool SiStripConfObject::isParameter ( const std::string &  name) const
inline

Definition at line 79 of file SiStripConfObject.h.

References parameters.

Referenced by StripCPE::StripCPE().

80  {
81  return( parameters.find(name) != parameters.end() );
82  }
void SiStripConfObject::printDebug ( std::stringstream &  ss) const

Prints the full list of parameters.

Definition at line 121 of file SiStripConfObject.cc.

References printSummary().

122 {
123  printSummary(ss);
124 }
void printSummary(std::stringstream &ss) const
Prints the full list of parameters.
void SiStripConfObject::printSummary ( std::stringstream &  ss) const

Prints the full list of parameters.

Definition at line 113 of file SiStripConfObject.cc.

References parameters.

Referenced by printDebug().

114 {
115  parMap::const_iterator it = parameters.begin();
116  for( ; it != parameters.end(); ++it ) {
117  ss << "parameter name = " << it->first << " value = " << it->second << std::endl;
118  }
119 }
template<class valueType >
bool SiStripConfObject::put ( const std::string &  name,
const valueType &  inputValue 
)
inline

Definition at line 35 of file SiStripConfObject.h.

References parameters, and contentValuesCheck::ss.

36  {
37  std::stringstream ss;
38  ss << inputValue;
39  if( parameters.insert(std::make_pair(name, ss.str())).second ) return true;
40  return false;
41  }
template<class Archive >
void SiStripConfObject::serialize ( Archive &  ar,
const unsigned int  version 
)
private
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, parameters, and contentValuesCheck::ss.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 93 of file SiStripConfObject.h.

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

Definition at line 93 of file SiStripConfObject.h.

Member Data Documentation

parMap SiStripConfObject::parameters