Go to the documentation of this file.00001 #ifndef SiStripConfObject_h
00002 #define SiStripConfObject_h
00003
00004 #include <iostream>
00005 #include <vector>
00006 #include <map>
00007 #include <algorithm>
00008 #include <iterator>
00009 #include <sstream>
00010
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012
00027 class SiStripConfObject
00028 {
00029 public:
00030 SiStripConfObject() {}
00031
00032 template <class valueType>
00033 bool put( const std::string & name, const valueType & inputValue )
00034 {
00035 std::stringstream ss;
00036 ss << inputValue;
00037 if( parameters.insert(std::make_pair(name, ss.str())).second ) return true;
00038 return false;
00039 }
00040
00041 template <class valueType>
00042 valueType get( const std::string & name ) const
00043 {
00044 valueType returnValue;
00045 parMap::const_iterator it = parameters.find(name);
00046 std::stringstream ss;
00047 if( it != parameters.end() ) {
00048 ss << it->second;
00049 ss >> returnValue;
00050 }
00051 else {
00052 std::cout << "WARNING: parameter " << name << " not found. Returning default value" << std::endl;
00053 }
00054 return returnValue;
00055 }
00056
00057 bool isParameter( const std::string & name ) const
00058 {
00059 return( parameters.find(name) != parameters.end() );
00060 }
00061
00063 void printSummary(std::stringstream & ss) const;
00065 void printDebug(std::stringstream & ss) const;
00066
00067 typedef std::map<std::string, std::string> parMap;
00068
00069 parMap parameters;
00070 };
00071
00072 #endif