00001 #ifndef ODSRPCONFIG_H 00002 #define ODSRPCONFIG_H 00003 00004 #include <map> 00005 #include <stdexcept> 00006 #include "OnlineDB/Oracle/interface/Oracle.h" 00007 #include "OnlineDB/EcalCondDB/interface/IODConfig.h" 00008 00009 #define USE_NORM 1 00010 #define USE_CHUN 2 00011 #define USE_BUFF 3 00012 00013 /* Buffer Size */ 00014 #define BUFSIZE 200; 00015 00016 00017 class ODSRPConfig : public IODConfig { 00018 public: 00019 friend class EcalCondDBInterface; 00020 ODSRPConfig(); 00021 ~ODSRPConfig(); 00022 00023 // User data methods 00024 inline std::string getTable() { return "ECAL_SRP_CONFIGURATION"; } 00025 00026 inline void setId(int id) { m_ID = id; } 00027 inline int getId() const { return m_ID; } 00028 00029 inline void setDebugMode(int x) { m_debug = x; } 00030 inline int getDebugMode() const { return m_debug; } 00031 00032 inline void setDummyMode(int x) { m_dummy= x; } 00033 inline int getDummyMode() const { return m_dummy; } 00034 00035 inline void setPatternDirectory(std::string x) { m_patdir = x; } 00036 inline std::string getPatternDirectory() const { return m_patdir; } 00037 00038 inline void setAutomaticMasks(int x) { m_auto = x; } 00039 inline int getAutomaticMasks() const { return m_auto; } 00040 00041 inline void setAutomaticSrpSelect(int x) { m_auto_srp = x; } 00042 inline int getAutomaticSrpSelect() const { return m_auto_srp; } 00043 00044 inline void setSRP0BunchAdjustPosition(int x) { m_bnch = x; } 00045 inline int getSRP0BunchAdjustPosition() const { return m_bnch; } 00046 00047 inline void setConfigFile(std::string x) { m_file = x; } 00048 inline std::string getConfigFile() const { return m_file; } 00049 00050 inline void setSRPClob(unsigned char* x) { m_srp_clob = x; } 00051 inline unsigned char* getSRPClob() const { return m_srp_clob; } 00052 inline unsigned int getSRPClobSize() const { return m_size; } 00053 00054 void setParameters(std::map<std::string,std::string> my_keys_map); 00055 00056 private: 00057 void prepareWrite() throw(std::runtime_error); 00058 void writeDB() throw(std::runtime_error); 00059 void clear(); 00060 void fetchData(ODSRPConfig * result) throw(std::runtime_error); 00061 int fetchID() throw(std::runtime_error); 00062 00063 00064 int fetchNextId() throw(std::runtime_error); 00065 00066 // User data 00067 int m_ID; 00068 unsigned char* m_srp_clob; 00069 int m_debug; 00070 int m_dummy; 00071 std::string m_file; 00072 std::string m_patdir; 00073 int m_auto, m_auto_srp; 00074 int m_bnch; 00075 unsigned int m_size; 00076 00077 }; 00078 00079 #endif