00001 // Last commit: $Id: SiStripDbParams.h,v 1.12 2008/06/06 14:45:23 bainbrid Exp $ 00002 00003 #ifndef OnlineDB_SiStripConfigDb_SiStripDbParams_h 00004 #define OnlineDB_SiStripConfigDb_SiStripDbParams_h 00005 00006 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h" 00007 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00008 #include "OnlineDB/SiStripConfigDb/interface/SiStripPartition.h" 00009 #include "boost/cstdint.hpp" 00010 #include "boost/range/iterator_range.hpp" 00011 #include <ostream> 00012 #include <sstream> 00013 #include <string> 00014 #include <vector> 00015 #include <map> 00016 00017 class SiStripDbParams; 00018 00020 std::ostream& operator<< ( std::ostream&, const SiStripDbParams& ); 00021 00027 class SiStripDbParams { 00028 00029 public: 00030 00031 // ---------- cons(de)structors ---------- 00032 00033 SiStripDbParams(); 00034 00035 SiStripDbParams( const SiStripDbParams& ); 00036 00037 SiStripDbParams& operator= ( const SiStripDbParams& ); 00038 00039 bool operator== ( const SiStripDbParams& ) const; 00040 00041 bool operator!= ( const SiStripDbParams& ) const; 00042 00043 ~SiStripDbParams(); 00044 00045 // ---------- typedefs ---------- 00046 00047 typedef std::map< std::string, SiStripPartition > SiStripPartitions; 00048 00049 typedef boost::iterator_range<SiStripPartitions::const_iterator> const_iterator_range; 00050 00051 typedef boost::iterator_range<SiStripPartitions::iterator> iterator_range; 00052 00053 // ---------- database-related ---------- 00054 00055 bool usingDb() const; 00056 00057 std::string confdb() const; 00058 00059 std::string user() const; 00060 00061 std::string passwd() const; 00062 00063 std::string path() const; 00064 00065 bool usingDbCache() const; 00066 00067 std::string sharedMemory() const; 00068 00069 std::string tnsAdmin() const; 00070 00071 // ---------- partition-related ---------- 00072 00074 const_iterator_range partitions() const; 00075 00077 iterator_range partitions(); 00078 00080 SiStripPartitions::const_iterator partition( std::string partition_name ) const; 00081 00083 SiStripPartitions::iterator partition( std::string partition_name ); 00084 00086 void clearPartitions(); 00087 00089 void addPartition( const SiStripPartition& ); 00090 00092 std::vector<std::string> partitionNames() const; 00093 00095 std::vector<std::string> partitionNames( std::string ) const; 00096 00098 std::string partitionNames( const std::vector<std::string>& ) const; 00099 00100 // ---------- setters ---------- 00101 00102 void usingDb( bool ); 00103 00104 void usingDbCache( bool ); 00105 00106 void sharedMemory( std::string ); 00107 00108 void pset( const edm::ParameterSet& ); 00109 00110 void confdb( const std::string& ); 00111 00112 void confdb( const std::string& user, 00113 const std::string& passwd, 00114 const std::string& path ); 00115 00116 void reset(); 00117 00118 // ---------- xml file names ---------- 00119 00120 std::vector<std::string> inputModuleXmlFiles() const; 00121 00122 std::vector<std::string> inputDcuInfoXmlFiles() const; 00123 00124 std::vector<std::string> inputFecXmlFiles() const; 00125 00126 std::vector<std::string> inputFedXmlFiles() const; 00127 00128 std::string outputModuleXml() const; 00129 00130 std::string outputDcuInfoXml() const; 00131 00132 std::string outputFecXml() const; 00133 00134 std::string outputFedXml() const; 00135 00136 void print( std::stringstream& ) const; 00137 00138 // ---------- private member data ---------- 00139 00140 private: 00141 00142 bool usingDb_; 00143 00144 std::string confdb_; 00145 00146 std::string user_; 00147 00148 std::string passwd_; 00149 00150 std::string path_; 00151 00152 bool usingDbCache_; 00153 00154 std::string sharedMemory_; 00155 00156 std::string tnsAdmin_; 00157 00158 SiStripPartitions partitions_; 00159 00160 std::string outputModuleXml_; 00161 00162 std::string outputDcuInfoXml_; 00163 00164 std::string outputFecXml_; 00165 00166 std::string outputFedXml_; 00167 00168 }; 00169 00170 // ---------- inline methods ---------- 00171 00172 inline bool SiStripDbParams::usingDb() const { return usingDb_; } 00173 inline std::string SiStripDbParams::confdb() const { return confdb_; } 00174 inline std::string SiStripDbParams::user() const { return user_; } 00175 inline std::string SiStripDbParams::passwd() const { return passwd_; } 00176 inline std::string SiStripDbParams::path() const { return path_; } 00177 inline bool SiStripDbParams::usingDbCache() const { return usingDbCache_; } 00178 inline std::string SiStripDbParams::sharedMemory() const { return sharedMemory_; } 00179 inline std::string SiStripDbParams::tnsAdmin() const { return tnsAdmin_; } 00180 00181 inline SiStripDbParams::const_iterator_range SiStripDbParams::partitions() const { return const_iterator_range( partitions_.begin(), 00182 partitions_.end() ); } 00183 inline SiStripDbParams::iterator_range SiStripDbParams::partitions() { return iterator_range( partitions_.begin(), 00184 partitions_.end() ); } 00185 00186 inline std::string SiStripDbParams::outputModuleXml() const { return outputModuleXml_; } 00187 inline std::string SiStripDbParams::outputDcuInfoXml() const { return outputDcuInfoXml_; } 00188 inline std::string SiStripDbParams::outputFecXml() const { return outputFecXml_; } 00189 inline std::string SiStripDbParams::outputFedXml() const { return outputFedXml_; } 00190 00191 inline void SiStripDbParams::clearPartitions() { partitions_.clear(); } 00192 inline void SiStripDbParams::usingDb( bool using_db ) { usingDb_ = using_db; } 00193 inline void SiStripDbParams::usingDbCache( bool using_cache ) { usingDbCache_ = using_cache; } 00194 inline void SiStripDbParams::sharedMemory( std::string name ) { sharedMemory_ = name; } 00195 00196 #endif // OnlineDB_SiStripConfigDb_SiStripDbParams_h