CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
IODConfig Class Referenceabstract

#include <IODConfig.h>

Inheritance diagram for IODConfig:
IDBObject FEConfigBadStripDat FEConfigBadStripInfo FEConfigBadTTDat FEConfigBadTTInfo FEConfigBadXTDat FEConfigBadXTInfo FEConfigCokeInfo FEConfigFgrInfo FEConfigLinInfo FEConfigLUTInfo FEConfigMainInfo FEConfigOddWeightInfo FEConfigPedInfo FEConfigSlidingInfo FEConfigSpikeInfo FEConfigTimingInfo FEConfigWeightInfo ODBadTTDat ODBadTTInfo ODBadXTDat ODBadXTInfo ODCCSConfig ODCCSCycle ODCond2ConfInfo ODDCCConfig ODDCCCycle ODDCUConfig ODDCUCycle ODDelaysDat ODEcalCycle ODFEDAQConfig ODFEDelaysInfo ODFEPedestalOffsetInfo ODFEWeightsInfo ODGolBiasCurrentDat ODGolBiasCurrentInfo ODJBH4Config ODJBH4Cycle ODLaserConfig ODLaserCycle ODLTCConfig ODLTCCycle ODLTSConfig ODLTSCycle ODPedestalOffsetsDat ODRunConfigCycleInfo ODRunConfigInfo ODRunConfigSeqInfo ODScanConfig ODScanCycle ODSRPConfig ODSRPCycle ODTCCConfig ODTCCCycle ODTCCEEConfig ODTCCEECycle ODTowersToByPassDat ODTowersToByPassInfo ODTTCciConfig ODTTCciCycle ODTTCFConfig ODTTCFCycle ODVfeToRejectDat ODVfeToRejectInfo ODWeightsDat ODWeightsSamplesDat

Public Types

typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 

Public Member Functions

std::string getConfigTag ()
 
virtual std::string getTable ()=0
 
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 ()
 

Public Attributes

std::string m_config_tag
 

Protected Member Functions

void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
virtual void prepareWrite () noexcept(false)=0
 
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

Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 

Detailed Description

Abstract interface for data in the conditions DB

Definition at line 18 of file IODConfig.h.

Member Typedef Documentation

◆ Clob

typedef oracle::occi::Clob IODConfig::Clob

Definition at line 23 of file IODConfig.h.

◆ SQLException

typedef oracle::occi::SQLException IODConfig::SQLException

Definition at line 20 of file IODConfig.h.

◆ Statement

typedef oracle::occi::Statement IODConfig::Statement

Definition at line 21 of file IODConfig.h.

◆ Stream

typedef oracle::occi::Stream IODConfig::Stream

Definition at line 22 of file IODConfig.h.

Member Function Documentation

◆ checkPrepare()

void IODConfig::checkPrepare ( )
inlineprotectednoexcept

Definition at line 36 of file IODConfig.h.

36  {
37  if (m_writeStmt == nullptr) {
38  throw(std::runtime_error("Write statement not prepared"));
39  }
40  }

References m_writeStmt.

◆ createReadStatement()

void IODConfig::createReadStatement ( )
inlineprotectednoexcept

Definition at line 50 of file IODConfig.h.

50 { m_readStmt = m_conn->createStatement(); }

References IDBObject::m_conn, and m_readStmt.

◆ getConfigTag()

std::string IODConfig::getConfigTag ( )
inline

Definition at line 30 of file IODConfig.h.

30 { return m_config_tag; }

References m_config_tag.

◆ getTable()

virtual std::string IODConfig::getTable ( )
pure virtual

◆ populateClob()

void IODConfig::populateClob ( Clob clob,
std::string  fname,
unsigned int  bufsize 
)
inlineprotectednoexcept

Definition at line 67 of file IODConfig.h.

67  {
68  try {
69  // Uses stream here
70  std::cout << "Populating the Clob using writeBuffer(Stream) method" << std::endl;
71  std::cout << "we are here0" << std::endl;
72 
73  const char *file = fname.c_str();
74  std::cout << "we are here0.5 file is:" << fname << std::endl;
75 
76  std::ifstream inFile;
77  inFile.open(file, std::ios::in);
78  if (!inFile) {
79  std::cout << fname << " file not found\n";
80  inFile.close();
81 
82  std::string fname2 = "/nfshome0/ecaldev/francesca/null_file.txt";
83  inFile.open(fname2.c_str(), std::ios::in);
84  }
85  if (bufsize == 0) {
86  inFile.seekg(0, std::ios::end);
87  bufsize = inFile.tellg();
88  std::cout << " bufsize =" << bufsize << std::endl;
89  // set file pointer to start again
90  inFile.seekg(0, std::ios::beg);
91  }
92 
93  char *buffer = new char[bufsize + 1];
94 
95  std::cout << "we are here1" << std::endl;
96  unsigned int size;
97  Stream *strm = clob.getStream();
98  std::cout << "we are here2" << std::endl;
99  // while(inFile)
100  // {
101  int buf = 0;
102  memset(buffer, buf, bufsize + 1);
103  inFile.read(buffer, bufsize);
104  std::cout << "we are here2.5" << std::endl;
105 
106  strm->writeBuffer(buffer, strlen(buffer));
107  std::cout << "we are here2.6" << std::endl;
108 
109  //}
110  std::cout << "we are here3" << std::endl;
111  strcpy(buffer, " ");
112  size = strlen(buffer);
113  strm->writeLastBuffer(buffer, size);
114  clob.closeStream(strm);
115  inFile.close();
116  std::cout << "we are here4" << std::endl;
117  delete[] buffer;
118  } catch (SQLException &e) {
119  throw(std::runtime_error(std::string("populateClob(): ") + e.getMessage()));
120  }
121  std::cout << "Populating the Clob - Success" << std::endl;
122  }

References visDQMUpload::buf, edmScanValgrind::buffer, gather_cfg::cout, MillePedeFileConverter_cfg::e, mps_fire::end, FrontierConditions_GlobalTag_cff::file, alignmentValidation::fname, recoMuon::in, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ prepareWrite()

virtual void IODConfig::prepareWrite ( )
protectedpure virtualnoexcept

◆ readClob()

unsigned char* IODConfig::readClob ( Clob clob,
int  size 
)
inlineprotectednoexcept

Definition at line 124 of file IODConfig.h.

124  {
125  try {
126  Stream *instream = clob.getStream(1, 0);
127  unsigned char *buffer = new unsigned char[size];
128  int buf = 0;
129  memset(buffer, buf, size);
130 
131  instream->readBuffer((char *)buffer, size);
132  std::cout << "remember to delete the char* at the end of the program ";
133  for (int i = 0; i < size; ++i)
134  std::cout << (char)buffer[i];
135  std::cout << std::endl;
136 
137  clob.closeStream(instream);
138 
139  return buffer;
140 
141  } catch (SQLException &e) {
142  throw(std::runtime_error(std::string("readClob(): ") + e.getMessage()));
143  }
144  }

References visDQMUpload::buf, edmScanValgrind::buffer, gather_cfg::cout, MillePedeFileConverter_cfg::e, mps_fire::i, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ setConfigTag()

void IODConfig::setConfigTag ( std::string  x)
inline

Definition at line 29 of file IODConfig.h.

29 { m_config_tag = x; }

References m_config_tag, and x.

Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalTPGFineGrainEBIdMapHandler::getNewObjects(), popcon::EcalTPGLinConstHandler::getNewObjects(), popcon::EcalTPGLutIdMapHandler::getNewObjects(), popcon::EcalTPGOddWeightIdMapHandler::getNewObjects(), popcon::EcalTPGBadStripHandler::getNewObjects(), popcon::EcalTPGBadTTHandler::getNewObjects(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), popcon::EcalTPGTPModeHandler::getNewObjects(), popcon::EcalTPGWeightIdMapHandler::getNewObjects(), popcon::EcalTPGBadXTHandler::getNewObjects(), popcon::EcalTPGFineGrainEBGroupHandler::getNewObjects(), popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects(), popcon::EcalTPGWeightGroupHandler::getNewObjects(), popcon::EcalTPGOddWeightGroupHandler::getNewObjects(), popcon::EcalTPGSlidingWindowHandler::getNewObjects(), popcon::EcalTPGFineGrainStripEEHandler::getNewObjects(), popcon::EcalTPGPedestalsHandler::getNewObjects(), popcon::EcalTPGSpikeThresholdHandler::getNewObjects(), popcon::EcalTPGLutGroupHandler::getNewObjects(), EcalTPGDBApp::writeToConfDB_Delay(), EcalTPGDBApp::writeToConfDB_Spike(), EcalTPGDBApp::writeToConfDB_TPGFgr(), EcalTPGDBApp::writeToConfDB_TPGLinearCoef(), EcalTPGDBApp::writeToConfDB_TPGLUT(), EcalTPGDBApp::writeToConfDB_TPGMain(), EcalTPGDBApp::writeToConfDB_TPGPedestals(), EcalTPGDBApp::writeToConfDB_TPGSliding(), EcalTPGDBApp::writeToConfDB_TPGWeight(), and EcalDccWeightBuilder::writeWeightToDB().

◆ setPrefetchRowCount()

void IODConfig::setPrefetchRowCount ( int  ncount)
inlineprotectednoexcept

Definition at line 52 of file IODConfig.h.

52 { m_readStmt->setPrefetchRowCount(ncount); }

References m_readStmt.

◆ terminateReadStatement()

void IODConfig::terminateReadStatement ( )
inlineprotectednoexcept

Definition at line 54 of file IODConfig.h.

54  {
55  if (m_readStmt != nullptr) {
56  m_conn->terminateStatement(m_readStmt);
57  } else {
58  std::cout << "Warning from IDataItem: statement was aleady closed" << std::endl;
59  }
60  }

References gather_cfg::cout, IDBObject::m_conn, and m_readStmt.

◆ terminateWriteStatement()

void IODConfig::terminateWriteStatement ( )
inlineprotectednoexcept

Definition at line 42 of file IODConfig.h.

42  {
43  if (m_writeStmt != nullptr) {
44  m_conn->terminateStatement(m_writeStmt);
45  } else {
46  std::cout << "Warning from IDataItem: statement was aleady closed" << std::endl;
47  }
48  }

References gather_cfg::cout, IDBObject::m_conn, and m_writeStmt.

Member Data Documentation

◆ m_config_tag

std::string IODConfig::m_config_tag

Definition at line 25 of file IODConfig.h.

Referenced by getConfigTag(), and setConfigTag().

◆ m_readStmt

Statement* IODConfig::m_readStmt
protected

Definition at line 34 of file IODConfig.h.

Referenced by createReadStatement(), setPrefetchRowCount(), and terminateReadStatement().

◆ m_writeStmt

Statement* IODConfig::m_writeStmt
protected

Definition at line 33 of file IODConfig.h.

Referenced by checkPrepare(), and terminateWriteStatement().

mps_fire.i
i
Definition: mps_fire.py:428
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DDAxes::x
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
IODConfig::Stream
oracle::occi::Stream Stream
Definition: IODConfig.h:22
mps_fire.end
end
Definition: mps_fire.py:242
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
recoMuon::in
Definition: RecoMuonEnumerators.h:6
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
IODConfig::m_config_tag
std::string m_config_tag
Definition: IODConfig.h:25
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37