CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/OnlineDB/SiStripConfigDb/interface/SiStripDbParams.h

Go to the documentation of this file.
00001 // Last commit: $Id: SiStripDbParams.h,v 1.13 2009/02/20 10:01:15 alinn 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 SiStripPartitions::size_type size_type;
00050   
00051   typedef boost::iterator_range<SiStripPartitions::const_iterator> const_iterator_range;
00052 
00053   typedef boost::iterator_range<SiStripPartitions::iterator> iterator_range;
00054 
00055   // ---------- database-related ----------
00056 
00057   bool usingDb() const;
00058   
00059   std::string confdb() const;
00060 
00061   std::string user() const;
00062 
00063   std::string passwd() const;
00064 
00065   std::string path() const;
00066 
00067   bool usingDbCache() const;
00068 
00069   std::string sharedMemory() const;
00070 
00071   std::string tnsAdmin() const;
00072 
00073   // ---------- partition-related ----------
00074 
00076   const_iterator_range partitions() const;
00077 
00079   iterator_range partitions();
00080 
00082   SiStripPartitions::const_iterator partition( std::string partition_name ) const;
00083   
00085   SiStripPartitions::iterator partition( std::string partition_name );
00086   
00088   void clearPartitions();
00089 
00091   void addPartition( const SiStripPartition& );
00092 
00094   std::vector<std::string> partitionNames() const;
00095   
00097   std::vector<std::string> partitionNames( std::string ) const;
00098   
00100   std::string partitionNames( const std::vector<std::string>& ) const;
00101 
00103   size_type partitionsSize() const;
00104   
00105   // ---------- setters ----------
00106 
00107   void usingDb( bool );
00108   
00109   void usingDbCache( bool );
00110 
00111   void sharedMemory( std::string );
00112 
00113   void pset( const edm::ParameterSet& );
00114   
00115   void confdb( const std::string& );
00116   
00117   void confdb( const std::string& user,
00118                const std::string& passwd,
00119                const std::string& path );
00120   
00121   void reset(); 
00122   
00123   // ---------- xml file names ----------
00124 
00125   std::vector<std::string> inputModuleXmlFiles() const;
00126 
00127   std::vector<std::string> inputDcuInfoXmlFiles() const;
00128 
00129   std::vector<std::string> inputFecXmlFiles() const;
00130 
00131   std::vector<std::string> inputFedXmlFiles() const;
00132 
00133   std::string outputModuleXml() const;
00134 
00135   std::string outputDcuInfoXml() const;
00136 
00137   std::string outputFecXml() const;
00138 
00139   std::string outputFedXml() const;
00140 
00141   void print( std::stringstream& ) const; 
00142 
00143   // ---------- private member data ---------- 
00144   
00145  private:
00146   
00147   bool usingDb_;
00148 
00149   std::string confdb_;
00150 
00151   std::string user_;
00152 
00153   std::string passwd_;
00154 
00155   std::string path_;
00156 
00157   bool usingDbCache_;
00158 
00159   std::string sharedMemory_;
00160 
00161   std::string tnsAdmin_;
00162 
00163   SiStripPartitions partitions_; 
00164 
00165   std::string outputModuleXml_;
00166 
00167   std::string outputDcuInfoXml_;
00168 
00169   std::string outputFecXml_;
00170 
00171   std::string outputFedXml_;
00172 
00173 };
00174 
00175 // ---------- inline methods ----------
00176 
00177 inline bool SiStripDbParams::usingDb() const { return usingDb_; }
00178 inline std::string SiStripDbParams::confdb() const { return confdb_; }
00179 inline std::string SiStripDbParams::user() const { return  user_; }
00180 inline std::string SiStripDbParams::passwd() const { return passwd_; }
00181 inline std::string SiStripDbParams::path() const { return path_; }
00182 inline bool SiStripDbParams::usingDbCache() const { return usingDbCache_; }
00183 inline std::string SiStripDbParams::sharedMemory() const { return sharedMemory_; }
00184 inline std::string SiStripDbParams::tnsAdmin() const { return tnsAdmin_; }
00185 
00186 inline SiStripDbParams::const_iterator_range SiStripDbParams::partitions() const { return const_iterator_range( partitions_.begin(), 
00187                                                                                                                 partitions_.end() ); }
00188 inline SiStripDbParams::iterator_range SiStripDbParams::partitions() { return iterator_range( partitions_.begin(), 
00189                                                                                               partitions_.end() ); }
00190 
00191 inline SiStripDbParams::size_type SiStripDbParams::partitionsSize() const { return partitions_.size(); }
00192 
00193 inline std::string SiStripDbParams::outputModuleXml() const { return outputModuleXml_; }
00194 inline std::string SiStripDbParams::outputDcuInfoXml() const { return outputDcuInfoXml_; }
00195 inline std::string SiStripDbParams::outputFecXml() const { return outputFecXml_; }
00196 inline std::string SiStripDbParams::outputFedXml() const { return outputFedXml_; }
00197 
00198 inline void SiStripDbParams::clearPartitions() { partitions_.clear(); }
00199 inline void SiStripDbParams::usingDb( bool using_db ) { usingDb_ = using_db; }
00200 inline void SiStripDbParams::usingDbCache( bool using_cache ) { usingDbCache_ = using_cache; }
00201 inline void SiStripDbParams::sharedMemory( std::string name ) { sharedMemory_ = name; }
00202 
00203 #endif // OnlineDB_SiStripConfigDb_SiStripDbParams_h