00001 #include "SpillServerMon.h"
00002
00003 #include "MessageService/MsgService.h"
00004 #include "DatabaseInterface/DbiOutRowStream.h"
00005 #include "DatabaseInterface/DbiResultSet.h"
00006 #include "DatabaseInterface/DbiValidityRec.h"
00007
00008 ClassImp(SpillServerMon)
00009
00010 CVSID("$Id: SpillServerMon.cxx,v 1.2 2006/11/23 19:19:36 blake Exp $");
00011
00012 #include "DatabaseInterface/DbiResultPtr.tpl"
00013 template class DbiResultPtr<SpillServerMon>;
00014
00015 #include "DatabaseInterface/DbiWriter.tpl"
00016 template class DbiWriter<SpillServerMon>;
00017
00018 SpillServerMon::SpillServerMon()
00019 {
00020 fTime=0;
00021 fStatus=0;
00022 fType=0;
00023 fND_sec=0;
00024 fND_nsec=0;
00025 fFD_sec=0;
00026 fFD_nsec=0;
00027 fGpsError=0;
00028 fRequest_sec=0;
00029 fWindowOpen_nsec=0;
00030 fWindowClose_nsec=0;
00031 }
00032
00033 SpillServerMon::SpillServerMon( Int_t timestamp,
00034 Int_t spillstatus,
00035 Int_t spilltype,
00036 Int_t spilltimeND_sec,
00037 Int_t spilltimeND_nsec,
00038 Int_t spilltimeFD_sec,
00039 Int_t spilltimeFD_nsec,
00040 Int_t spilltimeerror,
00041 Int_t request_sec,
00042 Int_t windowopen_nsec,
00043 Int_t windowclose_nsec )
00044 {
00045 fTime=timestamp;
00046 fStatus=spillstatus;
00047 fType=spilltype;
00048 fND_sec=spilltimeND_sec;
00049 fND_nsec=spilltimeND_nsec;
00050 fFD_sec=spilltimeFD_sec;
00051 fFD_nsec=spilltimeFD_nsec;
00052 fGpsError=spilltimeerror;
00053 fRequest_sec=request_sec;
00054 fWindowOpen_nsec=windowopen_nsec;
00055 fWindowClose_nsec=windowclose_nsec;
00056 }
00057
00058 SpillServerMon::SpillServerMon(const SpillServerMon& from) :
00059 DbiTableRow(from)
00060 {
00061 *this = from;
00062 }
00063
00064 SpillServerMon::~SpillServerMon()
00065 {
00066
00067 }
00068
00069 void SpillServerMon::Fill(DbiResultSet& rs, const DbiValidityRec* )
00070 {
00071 if ( rs.TableName() == "SPILLSERVERMON" ) {
00072 rs >> fTime
00073 >> fStatus
00074 >> fType
00075 >> fND_sec
00076 >> fND_nsec
00077 >> fFD_sec
00078 >> fFD_nsec
00079 >> fGpsError
00080 >> fRequest_sec
00081 >> fWindowOpen_nsec
00082 >> fWindowClose_nsec;
00083 }
00084 else {
00085 Int_t numCol = rs.NumCols();
00086 for (Int_t curCol = 2; curCol <= numCol; ++curCol) {
00087 string colName = rs.CurColName();
00088 if( colName == "TIMESTAMP" ) rs >> fTime;
00089 else if ( colName == "SPILLSTATUS" ) rs >> fStatus;
00090 else if ( colName == "SPILLTYPE" ) rs >> fType;
00091 else if ( colName == "SPILLTIMEND_SEC" ) rs >> fND_sec;
00092 else if ( colName == "SPILLTIMEND_NANOSEC" ) rs >> fND_nsec;
00093 else if ( colName == "SPILLTIMEFD_SEC" ) rs >> fFD_sec;
00094 else if ( colName == "SPILLTIMEFD_NANOSEC" ) rs >> fFD_nsec;
00095 else if ( colName == "SPILLTIMEERROR" ) rs >> fGpsError;
00096 else if ( colName == "REQUEST_SEC" ) rs >> fRequest_sec;
00097 else if ( colName == "WINDOWOPEN_NANOSEC" ) rs >> fWindowOpen_nsec;
00098 else if ( colName == "WINDOWCLOSE_NANOSEC" ) rs >> fWindowClose_nsec;
00099 else {
00100 MSG("SpillServerMon",Msg::kDebug) << "Ignoring column "
00101 << curCol
00102 << "(" << colName << ")" << endl;
00103 rs.IncrementCurCol();
00104 }
00105 }
00106 }
00107
00108 }
00109
00110 void SpillServerMon::Store(DbiOutRowStream& ors, const DbiValidityRec* ) const
00111 {
00112 ors << fTime
00113 << fStatus
00114 << fType
00115 << fND_sec
00116 << fND_nsec
00117 << fFD_sec
00118 << fFD_nsec
00119 << fGpsError
00120 << fRequest_sec
00121 << fWindowOpen_nsec
00122 << fWindowClose_nsec;
00123 }