CMS 3D CMS Logo

Classes | Functions
SiStripConfObject.h File Reference
#include "CondFormats/Serialization/interface/Serializable.h"
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iterator>
#include <sstream>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Classes

class  SiStripConfObject
 

Functions

template<>
std::string SiStripConfObject::get< std::string > (const std::string &name) const
 
template<>
std::vector< int > SiStripConfObject::get< std::vector< int > > (const std::string &name) const
 
template<>
std::vector< std::string > SiStripConfObject::get< std::vector< std::string > > (const std::string &name) const
 
template<>
bool SiStripConfObject::put< std::vector< int > > (const std::string &name, const std::vector< int > &inputValue)
 
template<>
bool SiStripConfObject::put< std::vector< std::string > > (const std::string &name, const std::vector< std::string > &inputValue)
 
template<>
bool SiStripConfObject::update< std::vector< int > > (const std::string &name, const std::vector< int > &inputValue)
 
template<>
bool SiStripConfObject::update< std::vector< std::string > > (const std::string &name, const std::vector< std::string > &inputValue)
 

Function Documentation

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

Definition at line 5 of file SiStripConfObject.cc.

References gather_cfg::cout, dataset::name, and AlCaHLTBitMon_QueryRunRegistry::string.

6 {
7  std::string returnValue;
8  parMap::const_iterator it = parameters.find(name);
9  std::stringstream ss;
10  if( it != parameters.end() ) {
11  ss << it->second;
12  ss >> returnValue;
13  }
14  else {
15  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
16  }
17  return returnValue;
18 }
template<>
std::vector<int> SiStripConfObject::get< std::vector< int > > ( const std::string &  name) const

Definition at line 50 of file SiStripConfObject.cc.

References gather_cfg::cout, HTMLExport::elem(), and dataset::name.

51 {
52  std::vector<int> returnValue;
53  parMap::const_iterator it = parameters.find(name);
54  std::stringstream ss;
55  if( it != parameters.end() ) {
56  ss << it->second;
57  int elem;
58  while(ss >> elem) returnValue.push_back(elem);
59  }
60  else {
61  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
62  }
63  return returnValue;
64 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
template<>
std::vector<std::string> SiStripConfObject::get< std::vector< std::string > > ( const std::string &  name) const

Definition at line 96 of file SiStripConfObject.cc.

References gather_cfg::cout, HTMLExport::elem(), dataset::name, and AlCaHLTBitMon_QueryRunRegistry::string.

97 {
98  std::vector<std::string> returnValue;
99  parMap::const_iterator it = parameters.find(name);
100  std::stringstream ss;
101  if( it != parameters.end() ) {
102  ss << it->second;
104  while(ss >> elem) returnValue.push_back(elem);
105  }
106  else {
107  std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
108  }
109  return returnValue;
110 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
template<>
bool SiStripConfObject::put< std::vector< int > > ( const std::string &  name,
const std::vector< int > &  inputValue 
)

Definition at line 21 of file SiStripConfObject.cc.

References HTMLExport::elem(), and dataset::name.

22 {
23  std::stringstream ss;
24  for(std::vector<int>::const_iterator elem=inputValue.begin();elem!=inputValue.end();++elem) {
25  ss << *elem << " ";
26  }
27  if( parameters.insert(std::make_pair(name, ss.str())).second ) return true;
28  return false;
29 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
template<>
bool SiStripConfObject::put< std::vector< std::string > > ( const std::string &  name,
const std::vector< std::string > &  inputValue 
)

Definition at line 67 of file SiStripConfObject.cc.

References HTMLExport::elem(), and dataset::name.

68 {
69  std::stringstream ss;
70  for(std::vector<std::string>::const_iterator elem=inputValue.begin();elem!=inputValue.end();++elem) {
71  ss << *elem << " ";
72  }
73  if( parameters.insert(std::make_pair(name, ss.str())).second ) return true;
74  return false;
75 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
template<>
bool SiStripConfObject::update< std::vector< int > > ( const std::string &  name,
const std::vector< int > &  inputValue 
)

Definition at line 32 of file SiStripConfObject.cc.

References gather_cfg::cout, HTMLExport::elem(), and dataset::name.

33 {
34  parMap::iterator it = parameters.find(name);
35  if (it == parameters.end()) {
36  std::cout << "WARNING in SiStripConfObject::update: parameter " << name << " not found, "
37  << "so cannot be updated to the vector of int of size'" << inputValue.size() << "'." << std::endl;
38  return false;
39  } else {
40  std::stringstream ss;
41  for(std::vector<int>::const_iterator elem=inputValue.begin();elem!=inputValue.end();++elem) {
42  ss << *elem << " ";
43  }
44  it->second = ss.str();
45  return true;
46  }
47 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
template<>
bool SiStripConfObject::update< std::vector< std::string > > ( const std::string &  name,
const std::vector< std::string > &  inputValue 
)

Definition at line 78 of file SiStripConfObject.cc.

References gather_cfg::cout, HTMLExport::elem(), and dataset::name.

79 {
80  parMap::iterator it = parameters.find(name);
81  if (it == parameters.end()) {
82  std::cout << "WARNING in SiStripConfObject::update: parameter " << name << " not found, "
83  << "so cannot be updated to the vector of std::string of size'" << inputValue.size() << "'." << std::endl;
84  return false;
85  } else {
86  std::stringstream ss;
87  for(std::vector<std::string>::const_iterator elem=inputValue.begin();elem!=inputValue.end();++elem) {
88  ss << *elem << " ";
89  }
90  it->second = ss.str();
91  return true;
92  }
93 }
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19