00001 00002 // $Id: FeeCableMap.cc,v 1.0 2009/7/26 11:40:00 $ 00003 // 00004 // FeeCablemap 00005 // 00006 // Package: Dbi (Database Interface). 00007 // 00008 // Concept: A concrete data type corresponding to a single row in a 00009 // database table of non-aggregated data. 00010 // 00011 // based on DataModel/DataSvc/ and Database/DbiSimDataSvc 00012 // - Weili Zhong 7/26/2009 00013 // 00014 // 00016 00017 #include "DbiDataSvc/FeeCableMap.h" 00018 #include "DatabaseInterface/DbiLog.h" 00019 #include "DatabaseInterface/DbiOutRowStream.h" 00020 #include "DatabaseInterface/DbiResultSet.h" 00021 #include "DatabaseInterface/DbiValidityRec.h" 00022 00023 // Removed: ClassImp(FeeCableMap) 00024 00025 00026 // Definition of static data members 00027 // ********************************* 00028 00029 00030 // Instantiate associated Result Pointer and writer classes. 00031 // ******************************************************** 00032 00033 #include "DatabaseInterface/DbiResultPtr.tpl" 00034 template class DbiResultPtr<FeeCableMap>; 00035 00036 #include "DatabaseInterface/DbiWriter.tpl" 00037 template class DbiWriter<FeeCableMap>; 00038 00039 // Definition of member functions (alphabetical order) 00040 // *************************************************** 00041 00042 00043 //..................................................................... 00044 00045 void FeeCableMap::Fill(DbiResultSet& rs, 00046 const DbiValidityRec* /* vrec */) { 00047 // 00048 // 00049 // Purpose: Fill object from Result Set 00050 // 00051 // Arguments: 00052 // rs in Result Set used to fill object 00053 // vrec in Associated validity record (or 0 if filling 00054 // DbiValidityRec) 00055 // Return: 00056 // 00057 // Modified from the SimPmtSpec 00058 // 00059 // Specification:- 00060 // ============= 00061 // 00062 // o Fill object from current row of Result Set. 00063 00064 // Program Notes:- 00065 // ============= 00066 00067 Int_t numCol = rs.NumCols(); 00068 // The first column (SeqNo) has already been processed. 00069 for (Int_t curCol = 2; curCol <= numCol; ++curCol) { 00070 string colName = rs.CurColName(); 00071 if ( colName == "CHANNELID" ){ 00072 int channelId = 0; rs >> channelId; 00073 m_feeChannelId = DayaBay::FeeChannelId ( channelId );} 00074 else if ( colName == "CHANNELDESC" ) rs >> m_channelDesc; 00075 else if ( colName == "FEEHARDWAREID" ){ 00076 int feeHardwareId = 0; rs >> feeHardwareId; 00077 m_feeHardwareId = DayaBay::FeeHardwareId ( feeHardwareId );} 00078 else if ( colName == "CHANHRDWDESC" ) rs >> m_chanHrdwDesc; 00079 else if ( colName == "SENSORID" ){ 00080 int sensorId = 0; rs >> sensorId; 00081 m_sensorId = DayaBay::DetectorSensor ( sensorId );} 00082 else if ( colName == "SENSORDESC" ) rs >> m_sensorDesc; 00083 else if ( colName == "PMTHARDWAREID" ){ 00084 int pmtHardwareId = 0; rs >> pmtHardwareId; 00085 m_pmtHardwareId = DayaBay::PmtHardwareId ( pmtHardwareId );} 00086 else if ( colName == "PMTHRDWDESC" ) rs >> m_pmtHrdwDesc; 00087 else { 00088 LOG(dbi,Logging::kDebug1) << "Ignoring column " << curCol 00089 << "(" << colName << ")" 00090 << "; not part of FeeCableMap" << std::endl; 00091 rs.IncrementCurCol(); 00092 } 00093 } 00094 } 00095 //..................................................................... 00096 00097 void FeeCableMap::Store(DbiOutRowStream& ors, 00098 const DbiValidityRec* /* vrec */) const { 00099 // 00100 // 00101 // Purpose: Stream object to output row stream 00102 // 00103 // Arguments: 00104 // ors in Output row stream. 00105 // vrec in Associated validity record (or 0 if filling 00106 // DbiValidityRec) 00107 // 00108 // Return: 00109 // 00110 // Contact: N. West 00111 // 00112 // Specification:- 00113 // ============= 00114 // 00115 // o Stream object to output row stream. 00116 00117 // Program Notes:- 00118 // ============= 00119 00120 // None. 00121 00122 cout<<"feecablemap::store"<<endl; 00123 ors << m_feeChannelId.fullPackedData() << m_channelDesc 00124 << m_feeHardwareId.id() << m_chanHrdwDesc 00125 << m_sensorId.fullPackedData() << m_sensorDesc 00126 << m_pmtHardwareId.id() << m_pmtHrdwDesc; 00127 } 00128