#include <OnlineDB/EcalCondDB/interface/FEConfigSlidingDat.h>
Public Member Functions | |
FEConfigSlidingDat () | |
float | getSliding () const |
std::string | getTable () |
void | setSliding (float mean) |
~FEConfigSlidingDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, FEConfigSlidingDat > *fillMap, FEConfigSlidingInfo *iconf) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, FEConfigSlidingDat > *data, FEConfigSlidingInfo *iconf) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const FEConfigSlidingDat *item, FEConfigSlidingInfo *iconf) throw (std::runtime_error) |
Private Attributes | |
float | m_sliding |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file FEConfigSlidingDat.h.
FEConfigSlidingDat::FEConfigSlidingDat | ( | ) |
Definition at line 11 of file FEConfigSlidingDat.cc.
References IDBObject::m_conn, IDBObject::m_env, IDataItem::m_readStmt, m_sliding, IDataItem::m_writeStmt, and NULL.
00012 { 00013 m_env = NULL; 00014 m_conn = NULL; 00015 m_writeStmt = NULL; 00016 m_readStmt = NULL; 00017 00018 m_sliding = 0; 00019 00020 }
FEConfigSlidingDat::~FEConfigSlidingDat | ( | ) |
void FEConfigSlidingDat::fetchData | ( | std::map< EcalLogicID, FEConfigSlidingDat > * | fillMap, | |
FEConfigSlidingInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
float FEConfigSlidingDat::getSliding | ( | ) | const [inline] |
Definition at line 21 of file FEConfigSlidingDat.h.
References m_sliding.
Referenced by writeArrayDB().
00021 { return m_sliding; }
std::string FEConfigSlidingDat::getTable | ( | ) | [inline, virtual] |
void FEConfigSlidingDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 30 of file FEConfigSlidingDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00032 { 00033 this->checkConnection(); 00034 00035 try { 00036 m_writeStmt = m_conn->createStatement(); 00037 m_writeStmt->setSQL("INSERT INTO fe_config_sliding_dat (sli_conf_id, logic_id, " 00038 "sliding ) " 00039 "VALUES (:sli_conf_id, :logic_id, " 00040 ":sliding )" ); 00041 } catch (SQLException &e) { 00042 throw(runtime_error("FEConfigSlidingDat::prepareWrite(): "+e.getMessage())); 00043 } 00044 }
void FEConfigSlidingDat::setSliding | ( | float | mean | ) | [inline] |
Definition at line 20 of file FEConfigSlidingDat.h.
References m_sliding.
Referenced by EcalTPGParamBuilder::analyze().
void FEConfigSlidingDat::writeArrayDB | ( | const std::map< EcalLogicID, FEConfigSlidingDat > * | data, | |
FEConfigSlidingInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 116 of file FEConfigSlidingDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), count, data, EcalLogicID::getLogicID(), getSliding(), IDataItem::m_writeStmt, and x.
00118 { 00119 this->checkConnection(); 00120 this->checkPrepare(); 00121 00122 int iconfID = iconf->fetchID(); 00123 if (!iconfID) { throw(runtime_error("FEConfigSlidingDat::writeArrayDB: ICONF not in DB")); } 00124 00125 00126 int nrows=data->size(); 00127 int* ids= new int[nrows]; 00128 int* iconfid_vec= new int[nrows]; 00129 float* xx= new float[nrows]; 00130 00131 00132 ub2* ids_len= new ub2[nrows]; 00133 ub2* iconf_len= new ub2[nrows]; 00134 ub2* x_len= new ub2[nrows]; 00135 00136 00137 const EcalLogicID* channel; 00138 const FEConfigSlidingDat* dataitem; 00139 int count=0; 00140 typedef map< EcalLogicID, FEConfigSlidingDat >::const_iterator CI; 00141 for (CI p = data->begin(); p != data->end(); ++p) { 00142 channel = &(p->first); 00143 int logicID = channel->getLogicID(); 00144 if (!logicID) { throw(runtime_error("FEConfigSlidingDat::writeArrayDB: Bad EcalLogicID")); } 00145 ids[count]=logicID; 00146 iconfid_vec[count]=iconfID; 00147 00148 dataitem = &(p->second); 00149 // dataIface.writeDB( channel, dataitem, iconf); 00150 float x=dataitem->getSliding(); 00151 00152 xx[count]=x; 00153 00154 00155 ids_len[count]=sizeof(ids[count]); 00156 iconf_len[count]=sizeof(iconfid_vec[count]); 00157 00158 x_len[count]=sizeof(xx[count]); 00159 00160 00161 count++; 00162 } 00163 00164 00165 try { 00166 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); 00167 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); 00168 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT , sizeof(xx[0]), x_len ); 00169 00170 m_writeStmt->executeArrayUpdate(nrows); 00171 00172 delete [] ids; 00173 delete [] iconfid_vec; 00174 delete [] xx; 00175 00176 delete [] ids_len; 00177 delete [] iconf_len; 00178 delete [] x_len; 00179 00180 } catch (SQLException &e) { 00181 throw(runtime_error("FEConfigSlidingDat::writeArrayDB(): "+e.getMessage())); 00182 } 00183 }
void FEConfigSlidingDat::writeDB | ( | const EcalLogicID * | ecid, | |
const FEConfigSlidingDat * | item, | |||
FEConfigSlidingInfo * | iconf | |||
) | throw (std::runtime_error) [private] |
Definition at line 48 of file FEConfigSlidingDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00050 { 00051 this->checkConnection(); 00052 this->checkPrepare(); 00053 00054 int iconfID = iconf->fetchID(); 00055 if (!iconfID) { throw(runtime_error("FEConfigSlidingDat::writeDB: ICONF not in DB")); } 00056 00057 int logicID = ecid->getLogicID(); 00058 if (!logicID) { throw(runtime_error("FEConfigSlidingDat::writeDB: Bad EcalLogicID")); } 00059 00060 try { 00061 m_writeStmt->setInt(1, iconfID); 00062 m_writeStmt->setInt(2, logicID); 00063 m_writeStmt->setFloat(3, item->getSliding()); 00064 00065 m_writeStmt->executeUpdate(); 00066 } catch (SQLException &e) { 00067 throw(runtime_error("FEConfigSlidingDat::writeDB(): "+e.getMessage())); 00068 } 00069 }
friend class EcalCondDBInterface [friend] |
float FEConfigSlidingDat::m_sliding [private] |
Definition at line 39 of file FEConfigSlidingDat.h.
Referenced by FEConfigSlidingDat(), getSliding(), and setSliding().