CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 int const ECALDB_NROWS = 1024
 

Detailed Description

Abstract interface for data in the conditions DB

Definition at line 18 of file IODConfig.h.

Member Typedef Documentation

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

Definition at line 23 of file IODConfig.h.

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

Definition at line 20 of file IODConfig.h.

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

Definition at line 21 of file IODConfig.h.

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

Definition at line 22 of file IODConfig.h.

Member Function Documentation

void IODConfig::checkPrepare ( )
inlineprotectednoexcept

Definition at line 36 of file IODConfig.h.

References m_writeStmt.

36  {
37  if (m_writeStmt == nullptr) {
38  throw(std::runtime_error("Write statement not prepared"));
39  }
40  }
Statement * m_writeStmt
Definition: IODConfig.h:33
void IODConfig::createReadStatement ( )
inlineprotectednoexcept

Definition at line 50 of file IODConfig.h.

References IDBObject::m_conn, and m_readStmt.

50 { m_readStmt = m_conn->createStatement(); }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_readStmt
Definition: IODConfig.h:34
std::string IODConfig::getConfigTag ( )
inline

Definition at line 30 of file IODConfig.h.

References m_config_tag.

30 { return m_config_tag; }
std::string m_config_tag
Definition: IODConfig.h:25
virtual std::string IODConfig::getTable ( )
pure virtual
void IODConfig::populateClob ( Clob clob,
std::string  fname,
unsigned int  bufsize 
)
inlineprotectednoexcept

Definition at line 67 of file IODConfig.h.

References visDQMUpload::buf, edmScanValgrind::buffer, gather_cfg::cout, alignCSCRings::e, dataset::end, mergeVDriftHistosByStation::file, recoMuon::in, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

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  }
oracle::occi::Stream Stream
Definition: IODConfig.h:22
string fname
main script
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
string end
Definition: dataset.py:937
tuple cout
Definition: gather_cfg.py:144
tuple size
Write out results.
virtual void IODConfig::prepareWrite ( )
protectedpure virtualnoexcept
unsigned char* IODConfig::readClob ( Clob clob,
int  size 
)
inlineprotectednoexcept

Definition at line 124 of file IODConfig.h.

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

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  }
oracle::occi::Stream Stream
Definition: IODConfig.h:22
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
tuple cout
Definition: gather_cfg.py:144
tuple size
Write out results.
void IODConfig::setConfigTag ( std::string  x)
inline

Definition at line 29 of file IODConfig.h.

References m_config_tag, and x.

Referenced by EcalTPGParamBuilder::analyze(), popcon::EcalTPGFineGrainEBIdMapHandler::getNewObjects(), popcon::EcalTPGLinConstHandler::getNewObjects(), popcon::EcalTPGLutIdMapHandler::getNewObjects(), popcon::EcalTPGBadStripHandler::getNewObjects(), popcon::EcalTPGOddWeightIdMapHandler::getNewObjects(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), popcon::EcalTPGBadTTHandler::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::EcalTPGLutGroupHandler::getNewObjects(), popcon::EcalTPGSpikeThresholdHandler::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(), EcalTPGDBApp::writeToConfDB_TPGWeight_doubleWeights(), and EcalDccWeightBuilder::writeWeightToDB().

29 { m_config_tag = x; }
std::string m_config_tag
Definition: IODConfig.h:25
void IODConfig::setPrefetchRowCount ( int  ncount)
inlineprotectednoexcept

Definition at line 52 of file IODConfig.h.

References m_readStmt.

52 { m_readStmt->setPrefetchRowCount(ncount); }
Statement * m_readStmt
Definition: IODConfig.h:34
void IODConfig::terminateReadStatement ( )
inlineprotectednoexcept

Definition at line 54 of file IODConfig.h.

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

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  }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_readStmt
Definition: IODConfig.h:34
tuple cout
Definition: gather_cfg.py:144
void IODConfig::terminateWriteStatement ( )
inlineprotectednoexcept

Definition at line 42 of file IODConfig.h.

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

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  }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

std::string IODConfig::m_config_tag

Definition at line 25 of file IODConfig.h.

Referenced by getConfigTag(), and setConfigTag().

Statement* IODConfig::m_readStmt
protected

Definition at line 34 of file IODConfig.h.

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

Statement* IODConfig::m_writeStmt
protected

Definition at line 33 of file IODConfig.h.

Referenced by checkPrepare(), and terminateWriteStatement().