#include <FEConfigWeightDat.h>
Public Member Functions | |
FEConfigWeightDat () | |
std::string | getTable () |
int | getWeightGroupId () const |
void | setWeightGroupId (int x) |
~FEConfigWeightDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, FEConfigWeightDat > *fillMap, FEConfigWeightInfo *iconf) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::map< EcalLogicID, FEConfigWeightDat > *data, FEConfigWeightInfo *iconf) throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const FEConfigWeightDat *item, FEConfigWeightInfo *iconf) throw (std::runtime_error) |
Private Attributes | |
int | m_group_id |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file FEConfigWeightDat.h.
FEConfigWeightDat::FEConfigWeightDat | ( | ) |
Definition at line 11 of file FEConfigWeightDat.cc.
References NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_group_id = 0; }
FEConfigWeightDat::~FEConfigWeightDat | ( | ) |
Definition at line 24 of file FEConfigWeightDat.cc.
{ }
void FEConfigWeightDat::fetchData | ( | std::map< EcalLogicID, FEConfigWeightDat > * | fillMap, |
FEConfigWeightInfo * | iconf | ||
) | throw (std::runtime_error) [private] |
std::string FEConfigWeightDat::getTable | ( | ) | [inline, virtual] |
Implements IDataItem.
Definition at line 18 of file FEConfigWeightDat.h.
{ return "FE_CONFIG_WEIGHT_DAT"; }
int FEConfigWeightDat::getWeightGroupId | ( | ) | const [inline] |
Definition at line 21 of file FEConfigWeightDat.h.
References m_group_id.
Referenced by writeArrayDB().
{ return m_group_id; }
void FEConfigWeightDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 30 of file FEConfigWeightDat.cc.
References alignCSCRings::e.
{ this->checkConnection(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO fe_config_weight_dat (wei_conf_id, logic_id, " "group_id ) " "VALUES (:wei_conf_id, :logic_id, " ":group_id )" ); } catch (SQLException &e) { throw(std::runtime_error("FEConfigWeightDat::prepareWrite(): "+e.getMessage())); } }
void FEConfigWeightDat::setWeightGroupId | ( | int | x | ) | [inline] |
Definition at line 20 of file FEConfigWeightDat.h.
References m_group_id, and x.
Referenced by EcalTPGParamBuilder::analyze().
{ m_group_id = x; }
void FEConfigWeightDat::writeArrayDB | ( | const std::map< EcalLogicID, FEConfigWeightDat > * | data, |
FEConfigWeightInfo * | iconf | ||
) | throw (std::runtime_error) [private] |
Definition at line 115 of file FEConfigWeightDat.cc.
References prof2calltree::count, AlCaHLTBitMon_QueryRunRegistry::data, EcalLogicID::getLogicID(), getWeightGroupId(), AlCaHLTBitMon_ParallelJobs::p, and x.
{ this->checkConnection(); this->checkPrepare(); int iconfID = iconf->fetchID(); if (!iconfID) { throw(std::runtime_error("FEConfigWeightDat::writeArrayDB: ICONF not in DB")); } int nrows=data->size(); int* ids= new int[nrows]; int* iconfid_vec= new int[nrows]; int* xx= new int[nrows]; ub2* ids_len= new ub2[nrows]; ub2* iconf_len= new ub2[nrows]; ub2* x_len= new ub2[nrows]; const EcalLogicID* channel; const FEConfigWeightDat* dataitem; int count=0; typedef map< EcalLogicID, FEConfigWeightDat >::const_iterator CI; for (CI p = data->begin(); p != data->end(); ++p) { channel = &(p->first); int logicID = channel->getLogicID(); if (!logicID) { throw(std::runtime_error("FEConfigWeightDat::writeArrayDB: Bad EcalLogicID")); } ids[count]=logicID; iconfid_vec[count]=iconfID; dataitem = &(p->second); // dataIface.writeDB( channel, dataitem, iconf); int x=dataitem->getWeightGroupId(); xx[count]=x; ids_len[count]=sizeof(ids[count]); iconf_len[count]=sizeof(iconfid_vec[count]); x_len[count]=sizeof(xx[count]); count++; } try { m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT, sizeof(iconfid_vec[0]),iconf_len); m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len ); m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len ); m_writeStmt->executeArrayUpdate(nrows); delete [] ids; delete [] iconfid_vec; delete [] xx; delete [] ids_len; delete [] iconf_len; delete [] x_len; } catch (SQLException &e) { throw(std::runtime_error("FEConfigWeightDat::writeArrayDB(): "+e.getMessage())); } }
void FEConfigWeightDat::writeDB | ( | const EcalLogicID * | ecid, |
const FEConfigWeightDat * | item, | ||
FEConfigWeightInfo * | iconf | ||
) | throw (std::runtime_error) [private] |
Definition at line 47 of file FEConfigWeightDat.cc.
References alignCSCRings::e.
{ this->checkConnection(); this->checkPrepare(); int iconfID = iconf->fetchID(); if (!iconfID) { throw(std::runtime_error("FEConfigWeightDat::writeDB: ICONF not in DB")); } int logicID = ecid->getLogicID(); if (!logicID) { throw(std::runtime_error("FEConfigWeightDat::writeDB: Bad EcalLogicID")); } try { m_writeStmt->setInt(1, iconfID); m_writeStmt->setInt(2, logicID); m_writeStmt->setInt(3, item->getWeightGroupId()); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("FEConfigWeightDat::writeDB(): "+e.getMessage())); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 13 of file FEConfigWeightDat.h.
int FEConfigWeightDat::m_group_id [private] |
Definition at line 39 of file FEConfigWeightDat.h.
Referenced by getWeightGroupId(), and setWeightGroupId().