00001 #include "BfieldMapHeader.h"
00002 #include "MessageService/MsgService.h"
00003 #include "DatabaseInterface/DbiOutRowStream.h"
00004 #include "DatabaseInterface/DbiResultSet.h"
00005 #include "DatabaseInterface/DbiValidityRec.h"
00006
00007 ClassImp(BfieldMapHeader)
00008
00009 CVSID("$Id: BfieldMapHeader.cxx,v 1.3 2005/03/11 16:17:47 west Exp $\n CVSID_DBIRESULTPTR ");
00010
00011 #include "DatabaseInterface/DbiResultPtr.tpl"
00012 template class DbiResultPtr<BfieldMapHeader>;
00013
00014 #include "DatabaseInterface/DbiWriter.tpl"
00015 template class DbiWriter<BfieldMapHeader>;
00016
00017 void BfieldMapHeader::Fill(DbiResultSet& rs, const DbiValidityRec* ) {
00018
00019 if ( rs.TableName() != "BfieldMapHeader"
00020 && rs.TableName() != "BFIELDMAPHEADER" ) {
00021 rs >> current >> xposinit >> xdelta >> xnum >> yposinit >> ydelta >> ynum >> maptype >> quadinfo;
00022 }
00023 else {
00024 Int_t numCol = rs.NumCols();
00025
00026 for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00027 string colName = rs.CurColName();
00028 if ( colName == "GEN_COIL_CURRENT_AMP_TURNS" ) rs >> current;
00029 else if ( colName == "XPOS_INIT" ) rs >> xposinit;
00030 else if ( colName == "X_DELTA" ) rs >> xdelta;
00031 else if ( colName == "X_NUMBER" ) rs >> xnum;
00032 else if ( colName == "YPOS_INIT" ) rs >> yposinit;
00033 else if ( colName == "Y_DELTA" ) rs >> ydelta;
00034 else if ( colName == "Y_NUMBER" ) rs >> ynum;
00035 else if ( colName == "MAPTYPE" ) rs >> maptype;
00036 else if ( colName == "QUADINFO" ) rs >> quadinfo;
00037 else {
00038 MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol
00039 << "(" << colName << ")"
00040 << "; not part of BfieldMapHeader" << endl;
00041 rs.IncrementCurCol();
00042 }
00043 }
00044 }
00045 }
00046
00047 void BfieldMapHeader::Store(DbiOutRowStream& ors, const DbiValidityRec* ) const {
00048 ors << current << xposinit << xdelta << xnum << yposinit << ydelta << ynum << maptype << quadinfo;
00049 }
00050