CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
ODJBH4Config Class Reference

#include <ODJBH4Config.h>

Inheritance diagram for ODJBH4Config:
IODConfig IDBObject

Public Member Functions

int getCaenBoardNumber () const
 
std::string getCaenBridgeType () const
 
int getCaenLinkNumber () const
 
std::string getCbd8210SerialNumber () const
 
std::string getHalAddressTableFile () const
 
std::string getHalModuleFile () const
 
std::string getHalStaticTableFile () const
 
int getId () const
 
std::string getTable () override
 
int getUseBuffer () const
 
 ODJBH4Config ()
 
void setCaenBoardNumber (int x)
 
void setCaenBridgeType (std::string x)
 
void setCaenLinkNumber (int x)
 
void setCbd8210SerialNumber (std::string x)
 
void setHalAddressTableFile (std::string x)
 
void setHalModuleFile (std::string x)
 
void setHalStaticTableFile (std::string x)
 
void setId (int id)
 
void setUseBuffer (int x)
 
 ~ODJBH4Config () override
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Private Member Functions

void clear ()
 
void fetchData (ODJBH4Config *result) noexcept(false)
 
int fetchID () noexcept(false)
 
int fetchNextId () noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB () noexcept(false)
 

Private Attributes

std::string m_caen1
 
int m_caen2
 
int m_caen3
 
std::string m_hal_add_file
 
std::string m_hal_mod_file
 
std::string m_hal_tab_file
 
int m_ID
 
std::string m_serial
 
int m_use_buffer
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
unsigned char * readClob (Clob &clob, int size) noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 9 of file ODJBH4Config.h.

Constructor & Destructor Documentation

◆ ODJBH4Config()

ODJBH4Config::ODJBH4Config ( )

Definition at line 10 of file ODJBH4Config.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15  m_config_tag = "";
16  m_ID = 0;
17  clear();
18 }

References clear().

◆ ~ODJBH4Config()

ODJBH4Config::~ODJBH4Config ( )
override

Definition at line 20 of file ODJBH4Config.cc.

20 {}

Member Function Documentation

◆ clear()

void ODJBH4Config::clear ( void  )
private

Definition at line 22 of file ODJBH4Config.cc.

22  {
23  m_use_buffer = 0;
24  m_hal_mod_file = "";
25  m_hal_add_file = "";
26  m_hal_tab_file = "";
27  m_serial = "";
28  m_caen1 = "";
29  m_caen2 = 0;
30  m_caen3 = 0;
31 }

◆ fetchData()

void ODJBH4Config::fetchData ( ODJBH4Config result)
privatenoexcept

Definition at line 99 of file ODJBH4Config.cc.

99  {
100  this->checkConnection();
101  result->clear();
102  if (result->getId() == 0) {
103  throw(std::runtime_error("ODJBH4Config::fetchData(): no Id defined for this ODJBH4Config "));
104  }
105 
106  try {
107  m_readStmt->setSQL(
108  "SELECT * FROM ECAL_Jbh4_CONFIGURATION "
109  " where ( jbh4_configuration_id = :1 or jbh4_tag=:2 )");
110  m_readStmt->setInt(1, result->getId());
111  m_readStmt->setString(2, result->getConfigTag());
112  ResultSet *rset = m_readStmt->executeQuery();
113 
114  rset->next();
115 
116  result->setId(rset->getInt(1));
117  result->setConfigTag(rset->getString(2));
118 
119  result->setUseBuffer(rset->getInt(3));
120  result->setHalModuleFile(rset->getString(4));
121  result->setHalAddressTableFile(rset->getString(5));
122  result->setHalStaticTableFile(rset->getString(6));
123  result->setCbd8210SerialNumber(rset->getString(7));
124  result->setCaenBridgeType(rset->getString(8));
125  result->setCaenLinkNumber(rset->getInt(9));
126  result->setCaenBoardNumber(rset->getInt(10));
127 
128  } catch (SQLException &e) {
129  throw(std::runtime_error("ODJBH4Config::fetchData(): " + e.getMessage()));
130  }
131 }

References MillePedeFileConverter_cfg::e, and mps_fire::result.

◆ fetchID()

int ODJBH4Config::fetchID ( )
privatenoexcept

Definition at line 133 of file ODJBH4Config.cc.

133  {
134  // Return from memory if available
135  if (m_ID != 0) {
136  return m_ID;
137  }
138 
139  this->checkConnection();
140 
141  try {
142  Statement *stmt = m_conn->createStatement();
143  stmt->setSQL(
144  "SELECT jbh4_configuration_id FROM ecal_jbh4_configuration "
145  "WHERE jbh4_tag=:jbh4_tag ");
146 
147  stmt->setString(1, getConfigTag());
148 
149  ResultSet *rset = stmt->executeQuery();
150 
151  if (rset->next()) {
152  m_ID = rset->getInt(1);
153  } else {
154  m_ID = 0;
155  }
156  m_conn->terminateStatement(stmt);
157  } catch (SQLException &e) {
158  throw(std::runtime_error("ODJBH4Config::fetchID: " + e.getMessage()));
159  }
160 
161  return m_ID;
162 }

References MillePedeFileConverter_cfg::e.

◆ fetchNextId()

int ODJBH4Config::fetchNextId ( )
privatenoexcept

Definition at line 33 of file ODJBH4Config.cc.

33  {
34  int result = 0;
35  try {
36  this->checkConnection();
37 
38  m_readStmt = m_conn->createStatement();
39  m_readStmt->setSQL("select ecal_JBH4_config_sq.NextVal from dual");
40  ResultSet *rset = m_readStmt->executeQuery();
41  while (rset->next()) {
42  result = rset->getInt(1);
43  }
44  m_conn->terminateStatement(m_readStmt);
45  return result;
46 
47  } catch (SQLException &e) {
48  throw(std::runtime_error("ODJBH4Config::fetchNextId(): " + e.getMessage()));
49  }
50 }

References MillePedeFileConverter_cfg::e, and mps_fire::result.

◆ getCaenBoardNumber()

int ODJBH4Config::getCaenBoardNumber ( ) const
inline

Definition at line 43 of file ODJBH4Config.h.

43 { return m_caen3; }

References m_caen3.

◆ getCaenBridgeType()

std::string ODJBH4Config::getCaenBridgeType ( ) const
inline

Definition at line 37 of file ODJBH4Config.h.

37 { return m_caen1; }

References m_caen1.

◆ getCaenLinkNumber()

int ODJBH4Config::getCaenLinkNumber ( ) const
inline

Definition at line 40 of file ODJBH4Config.h.

40 { return m_caen2; }

References m_caen2.

◆ getCbd8210SerialNumber()

std::string ODJBH4Config::getCbd8210SerialNumber ( ) const
inline

Definition at line 34 of file ODJBH4Config.h.

34 { return m_serial; }

References m_serial.

◆ getHalAddressTableFile()

std::string ODJBH4Config::getHalAddressTableFile ( ) const
inline

Definition at line 28 of file ODJBH4Config.h.

28 { return m_hal_add_file; }

References m_hal_add_file.

◆ getHalModuleFile()

std::string ODJBH4Config::getHalModuleFile ( ) const
inline

Definition at line 25 of file ODJBH4Config.h.

25 { return m_hal_mod_file; }

References m_hal_mod_file.

◆ getHalStaticTableFile()

std::string ODJBH4Config::getHalStaticTableFile ( ) const
inline

Definition at line 31 of file ODJBH4Config.h.

31 { return m_hal_tab_file; }

References m_hal_tab_file.

◆ getId()

int ODJBH4Config::getId ( void  ) const
inline

Definition at line 19 of file ODJBH4Config.h.

19 { return m_ID; }

References m_ID.

◆ getTable()

std::string ODJBH4Config::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 16 of file ODJBH4Config.h.

16 { return "ECAL_JBH4_CONFIGURATION"; }

◆ getUseBuffer()

int ODJBH4Config::getUseBuffer ( ) const
inline

Definition at line 22 of file ODJBH4Config.h.

22 { return m_use_buffer; }

References m_use_buffer.

◆ prepareWrite()

void ODJBH4Config::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 52 of file ODJBH4Config.cc.

52  {
53  this->checkConnection();
54  int next_id = fetchNextId();
55 
56  try {
57  m_writeStmt = m_conn->createStatement();
58  m_writeStmt->setSQL(
59  "INSERT INTO ECAL_Jbh4_CONFIGURATION ( jbh4_configuration_id, jbh4_tag, "
60  " useBuffer, halModuleFile, halAddressTableFile, halStaticTableFile, halcbd8210serialnumber, "
61  " caenbridgetype, caenlinknumber, caenboardnumber) "
62  " VALUES ( :1, :2, :3, :4, :5, :6, :7, :8 , :9, :10 )");
63 
64  m_writeStmt->setInt(1, next_id);
65  m_ID = next_id;
66  } catch (SQLException &e) {
67  throw(std::runtime_error("ODJBH4Config::prepareWrite(): " + e.getMessage()));
68  }
69 }

References MillePedeFileConverter_cfg::e.

◆ setCaenBoardNumber()

void ODJBH4Config::setCaenBoardNumber ( int  x)
inline

Definition at line 42 of file ODJBH4Config.h.

42 { m_caen3 = x; }

References m_caen3, and x.

◆ setCaenBridgeType()

void ODJBH4Config::setCaenBridgeType ( std::string  x)
inline

Definition at line 36 of file ODJBH4Config.h.

36 { m_caen1 = x; }

References m_caen1, and x.

◆ setCaenLinkNumber()

void ODJBH4Config::setCaenLinkNumber ( int  x)
inline

Definition at line 39 of file ODJBH4Config.h.

39 { m_caen2 = x; }

References m_caen2, and x.

◆ setCbd8210SerialNumber()

void ODJBH4Config::setCbd8210SerialNumber ( std::string  x)
inline

Definition at line 33 of file ODJBH4Config.h.

33 { m_serial = x; }

References m_serial, and x.

◆ setHalAddressTableFile()

void ODJBH4Config::setHalAddressTableFile ( std::string  x)
inline

Definition at line 27 of file ODJBH4Config.h.

27 { m_hal_add_file = x; }

References m_hal_add_file, and x.

◆ setHalModuleFile()

void ODJBH4Config::setHalModuleFile ( std::string  x)
inline

Definition at line 24 of file ODJBH4Config.h.

24 { m_hal_mod_file = x; }

References m_hal_mod_file, and x.

◆ setHalStaticTableFile()

void ODJBH4Config::setHalStaticTableFile ( std::string  x)
inline

Definition at line 30 of file ODJBH4Config.h.

30 { m_hal_tab_file = x; }

References m_hal_tab_file, and x.

◆ setId()

void ODJBH4Config::setId ( int  id)
inline

Definition at line 18 of file ODJBH4Config.h.

18 { m_ID = id; }

References triggerObjects_cff::id, and m_ID.

◆ setUseBuffer()

void ODJBH4Config::setUseBuffer ( int  x)
inline

Definition at line 21 of file ODJBH4Config.h.

21 { m_use_buffer = x; }

References m_use_buffer, and x.

◆ writeDB()

void ODJBH4Config::writeDB ( )
privatenoexcept

Definition at line 71 of file ODJBH4Config.cc.

71  {
72  this->checkConnection();
73  this->checkPrepare();
74 
75  try {
76  // number 1 is the id number 2 is the tag
77  m_writeStmt->setString(2, this->getConfigTag());
78 
79  m_writeStmt->setInt(3, this->getUseBuffer());
80  m_writeStmt->setString(4, this->getHalModuleFile());
81  m_writeStmt->setString(5, this->getHalAddressTableFile());
82  m_writeStmt->setString(6, this->getHalStaticTableFile());
83  m_writeStmt->setString(7, this->getCbd8210SerialNumber());
84  m_writeStmt->setString(8, this->getCaenBridgeType());
85  m_writeStmt->setInt(9, this->getCaenLinkNumber());
86  m_writeStmt->setInt(10, this->getCaenBoardNumber());
87 
88  m_writeStmt->executeUpdate();
89 
90  } catch (SQLException &e) {
91  throw(std::runtime_error("ODJBH4Config::writeDB(): " + e.getMessage()));
92  }
93  // Now get the ID
94  if (!this->fetchID()) {
95  throw(std::runtime_error("ODJBH4Config::writeDB: Failed to write"));
96  }
97 }

References MillePedeFileConverter_cfg::e.

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 11 of file ODJBH4Config.h.

Member Data Documentation

◆ m_caen1

std::string ODJBH4Config::m_caen1
private

Definition at line 61 of file ODJBH4Config.h.

Referenced by getCaenBridgeType(), and setCaenBridgeType().

◆ m_caen2

int ODJBH4Config::m_caen2
private

Definition at line 62 of file ODJBH4Config.h.

Referenced by getCaenLinkNumber(), and setCaenLinkNumber().

◆ m_caen3

int ODJBH4Config::m_caen3
private

Definition at line 63 of file ODJBH4Config.h.

Referenced by getCaenBoardNumber(), and setCaenBoardNumber().

◆ m_hal_add_file

std::string ODJBH4Config::m_hal_add_file
private

Definition at line 58 of file ODJBH4Config.h.

Referenced by getHalAddressTableFile(), and setHalAddressTableFile().

◆ m_hal_mod_file

std::string ODJBH4Config::m_hal_mod_file
private

Definition at line 57 of file ODJBH4Config.h.

Referenced by getHalModuleFile(), and setHalModuleFile().

◆ m_hal_tab_file

std::string ODJBH4Config::m_hal_tab_file
private

Definition at line 59 of file ODJBH4Config.h.

Referenced by getHalStaticTableFile(), and setHalStaticTableFile().

◆ m_ID

int ODJBH4Config::m_ID
private

Definition at line 54 of file ODJBH4Config.h.

Referenced by getId(), and setId().

◆ m_serial

std::string ODJBH4Config::m_serial
private

Definition at line 60 of file ODJBH4Config.h.

Referenced by getCbd8210SerialNumber(), and setCbd8210SerialNumber().

◆ m_use_buffer

int ODJBH4Config::m_use_buffer
private

Definition at line 56 of file ODJBH4Config.h.

Referenced by getUseBuffer(), and setUseBuffer().

IODConfig::Statement
oracle::occi::Statement Statement
Definition: IODConfig.h:21
ODJBH4Config::m_serial
std::string m_serial
Definition: ODJBH4Config.h:60
ODJBH4Config::getCaenLinkNumber
int getCaenLinkNumber() const
Definition: ODJBH4Config.h:40
ODJBH4Config::getCaenBridgeType
std::string getCaenBridgeType() const
Definition: ODJBH4Config.h:37
DDAxes::x
ODJBH4Config::m_caen1
std::string m_caen1
Definition: ODJBH4Config.h:61
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODJBH4Config::m_hal_add_file
std::string m_hal_add_file
Definition: ODJBH4Config.h:58
ODJBH4Config::getHalModuleFile
std::string getHalModuleFile() const
Definition: ODJBH4Config.h:25
ODJBH4Config::m_use_buffer
int m_use_buffer
Definition: ODJBH4Config.h:56
ODJBH4Config::getCbd8210SerialNumber
std::string getCbd8210SerialNumber() const
Definition: ODJBH4Config.h:34
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODJBH4Config::m_hal_mod_file
std::string m_hal_mod_file
Definition: ODJBH4Config.h:57
ODJBH4Config::getHalStaticTableFile
std::string getHalStaticTableFile() const
Definition: ODJBH4Config.h:31
ODJBH4Config::getUseBuffer
int getUseBuffer() const
Definition: ODJBH4Config.h:22
IODConfig::checkPrepare
void checkPrepare() noexcept(false)
Definition: IODConfig.h:36
IODConfig::getConfigTag
std::string getConfigTag()
Definition: IODConfig.h:30
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ODJBH4Config::fetchID
int fetchID() noexcept(false)
Definition: ODJBH4Config.cc:133
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODJBH4Config::m_caen3
int m_caen3
Definition: ODJBH4Config.h:63
ODJBH4Config::m_ID
int m_ID
Definition: ODJBH4Config.h:54
ODJBH4Config::getCaenBoardNumber
int getCaenBoardNumber() const
Definition: ODJBH4Config.h:43
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
ODJBH4Config::m_hal_tab_file
std::string m_hal_tab_file
Definition: ODJBH4Config.h:59
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
IODConfig::m_config_tag
std::string m_config_tag
Definition: IODConfig.h:25
ODJBH4Config::getHalAddressTableFile
std::string getHalAddressTableFile() const
Definition: ODJBH4Config.h:28
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
mps_fire.result
result
Definition: mps_fire.py:311
ODJBH4Config::clear
void clear()
Definition: ODJBH4Config.cc:22
ODJBH4Config::fetchNextId
int fetchNextId() noexcept(false)
Definition: ODJBH4Config.cc:33
ODJBH4Config::m_caen2
int m_caen2
Definition: ODJBH4Config.h:62
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37