Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

FabPlnInstall Class Reference

#include <FabPlnInstall.h>

Inheritance diagram for FabPlnInstall:

DbiTableRow List of all members.

Public Member Functions

 FabPlnInstall ()
virtual ~FabPlnInstall ()
const PlexPlaneIdGetPlaneId () const
const VldTimeStampGetInstallDate () const
std::string GetScintMdlMfgId (UShort_t indx) const
std::string GetSteelSlabMfgId (UShort_t indx) const
virtual DbiTableRowCreateTableRow () const
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const
virtual void Print (Option_t *option="") const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
virtual Int_t GetAggregateNo () const
virtual UInt_t GetIndex (UInt_t defIndex) const

Static Public Member Functions

const char * GetTableDescr ()
void SetDefensiveUnpkg (Bool_t defensive)
Bool_t GetDefensiveUnpkg ()

Private Member Functions

 FabPlnInstall (const FabPlnInstall &from)

Private Attributes

PlexPlaneId fPlaneId
VldTimeStamp fInstallDate
std::vector< std::string > fScintMdlMfgId
std::vector< std::string > fSteelSlabMfgId

Static Private Attributes

Bool_t fgDefensiveUnpkg = kFALSE

Constructor & Destructor Documentation

FabPlnInstall::FabPlnInstall  )  [inline]
 

Definition at line 39 of file FabPlnInstall.h.

References fInstallDate, fPlaneId, fScintMdlMfgId, and fSteelSlabMfgId.

00039                    : fPlaneId(), fInstallDate(2038,01,01,01,01,01)
00040       {  LEA_CTOR; 
00041 #ifdef EXPLICITINIT
00042          fScintMdlMfgId.reserve(8);
00043          fSteelSlabMfgId.reserve(8);
00044          for (int i=0; i<8; i++) {
00045            fScintMdlMfgId[i]="no-scint-id";
00046            fSteelSlabMfgId[i]="no-slab-id";
00047          }
00048 #else
00049          fScintMdlMfgId.resize(8,"no-scint-id");
00050          fSteelSlabMfgId.resize(8,"no-slab-id");
00051 #endif
00052       };

virtual FabPlnInstall::~FabPlnInstall  )  [inline, virtual]
 

Definition at line 54 of file FabPlnInstall.h.

00054 { LEA_DTOR; };

FabPlnInstall::FabPlnInstall const FabPlnInstall from  )  [inline, private]
 

Definition at line 89 of file FabPlnInstall.h.

00090      : DbiTableRow(from) { LEA_CTOR; *this = from; }


Member Function Documentation

virtual DbiTableRow* FabPlnInstall::CreateTableRow  )  const [inline, virtual]
 

Implements DbiTableRow.

Definition at line 64 of file FabPlnInstall.h.

00064 { return new FabPlnInstall; }

void FabPlnInstall::Fill DbiResultSet rs,
const DbiValidityRec vrec
[virtual]
 

Implements DbiTableRow.

Definition at line 54 of file FabPlnInstall.cxx.

References det, MSG, and UtilString::ToUpper().

00055                                                                   {
00056 //
00057 //
00058 //  Purpose:  Fill object from Result Set
00059 //
00060 //  Arguments: 
00061 //    rs           in    Result Set used to fill object
00062 //    vrec         in    Associated validity record (or 0 if filling
00063 //                                                    DbiValidityRec)
00064 //
00065 //  Return:    
00066 //
00067 //  Contact:   R. Hatcher
00068 //
00069 //  Specification:-
00070 //  =============
00071 //
00072 //  o Fill object from current row of Result Set.
00073 
00074 //  Program Notes:-
00075 //  =============
00076 
00077 //  None.
00078 
00079 
00080    UShort_t ipln = 1023;
00081 
00082    if (fgDefensiveUnpkg) {
00083 
00084       // unpack allowing for various column names and ordering
00085 
00086       Int_t numCol = rs.NumCols();
00087       //  The first column (SeqNo) has already been processed.
00088       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00089          string colName = rs.CurColName();
00090          if (      colName == "INSTALLDATE"  ) rs >> fInstallDate;
00091 
00092          else if ( colName == "MODULEID1")     rs >> fScintMdlMfgId[0];
00093          else if ( colName == "MODULEID2")     rs >> fScintMdlMfgId[1];
00094          else if ( colName == "MODULEID3")     rs >> fScintMdlMfgId[2];
00095          else if ( colName == "MODULEID4")     rs >> fScintMdlMfgId[3];
00096          else if ( colName == "MODULEID5")     rs >> fScintMdlMfgId[4];
00097          else if ( colName == "MODULEID6")     rs >> fScintMdlMfgId[5];
00098          else if ( colName == "MODULEID7")     rs >> fScintMdlMfgId[6];
00099          else if ( colName == "MODULEID8")     rs >> fScintMdlMfgId[7];
00100 
00101          else if ( colName == "STEELID1")      rs >> fSteelSlabMfgId[0];
00102          else if ( colName == "STEELID2")      rs >> fSteelSlabMfgId[1];
00103          else if ( colName == "STEELID3")      rs >> fSteelSlabMfgId[2];
00104          else if ( colName == "STEELID4")      rs >> fSteelSlabMfgId[3];
00105          else if ( colName == "STEELID5")      rs >> fSteelSlabMfgId[4];
00106          else if ( colName == "STEELID6")      rs >> fSteelSlabMfgId[5];
00107          else if ( colName == "STEELID7")      rs >> fSteelSlabMfgId[6];
00108          else if ( colName == "STEELID8")      rs >> fSteelSlabMfgId[7];
00109 
00110          else if ( colName == "PLANENUM")      rs >> ipln;
00111          else {
00112             static int nmsg = 25;
00113             if (nmsg-- > 0) MSG("Fab",Msg::kWarning) 
00114                << "Ignoring column " << rs.CurColNum() 
00115                << " (of " << rs.NumCols() << ")"
00116                << " \""<< colName << "\"; not part of "
00117                << ClassName() << endl;
00118             rs.IncrementCurCol();
00119          }
00120       }
00121    } // end defensive unpacking
00122    else {
00123       rs >> fInstallDate
00124          >> fScintMdlMfgId[0]
00125          >> fScintMdlMfgId[1]
00126          >> fScintMdlMfgId[2]
00127          >> fScintMdlMfgId[3]
00128          >> fScintMdlMfgId[4]
00129          >> fScintMdlMfgId[5]
00130          >> fScintMdlMfgId[6]
00131          >> fScintMdlMfgId[7]
00132          >> fSteelSlabMfgId[0]
00133          >> fSteelSlabMfgId[1]
00134          >> fSteelSlabMfgId[2]
00135          >> fSteelSlabMfgId[3]
00136          >> fSteelSlabMfgId[4]
00137          >> fSteelSlabMfgId[5]
00138          >> fSteelSlabMfgId[6]
00139          >> fSteelSlabMfgId[7]
00140          >> ipln;
00141     }
00142 
00143     // trim off lead/trailing blanks
00144     for (UInt_t i=0; i < 8; ++i ) {
00145       fScintMdlMfgId[i]  = 
00146         ToUpper(fScintMdlMfgId[i]).Strip(TString::kBoth).Data();
00147       fSteelSlabMfgId[i] = 
00148         ToUpper(fSteelSlabMfgId[i]).Strip(TString::kBoth).Data();
00149     }
00150 
00151     Detector::Detector_t det =
00152       (Detector::Detector_t) 
00153       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00154 
00155     fPlaneId = PlexPlaneId(det,ipln,kTRUE); // steel can be uninstrumented
00156 
00157 }

std::ostream & FabPlnInstall::FormatToOStream std::ostream &  os,
Option_t *  option = ""
const [virtual]
 

Definition at line 284 of file FabPlnInstall.cxx.

References VldTimeStamp::AsString(), PlexPlaneId::AsString(), fInstallDate, fPlaneId, fScintMdlMfgId, fSteelSlabMfgId, and Nav::GetName().

Referenced by operator<<(), and Print().

00286 {
00287   os << GetName() << " " 
00288      << fPlaneId.AsString("c") << " "
00289      << fInstallDate.AsString("sql") << endl;
00290   for (int i=0; i<8; ++i) {
00291     os << "  [" << i << "]  ";
00292     // left justification doesn't work consistently
00293     // not on std::strings and for some reason sometimes not at all
00294     // (but breaking it up like this seems to work sometimes)
00295     os.fill(' ');
00296     os << setw(16);
00297     os.setf(ios::left);  
00298     os << fScintMdlMfgId[i].c_str();
00299     os << " ";
00300     os.fill(' ');
00301     os << setw(16);
00302     os.setf(ios::left);  
00303     os << fSteelSlabMfgId[i].c_str();
00304     os << endl;
00305   }
00306   os.setf(ios::right);
00307   return os;
00308 }

Int_t FabPlnInstall::GetAggregateNo  )  const [virtual]
 

Reimplemented from DbiTableRow.

Definition at line 263 of file FabPlnInstall.cxx.

References fPlaneId, and PlexPlaneId::GetPlane().

00264 { 
00265   //return (int)fPlaneId.GetDetector()*100000000 + fPlaneId.GetPlane();
00266   return fPlaneId.GetPlane();
00267 }

Bool_t FabPlnInstall::GetDefensiveUnpkg  )  [inline, static]
 

Definition at line 83 of file FabPlnInstall.h.

00083 { return fgDefensiveUnpkg; }

UInt_t FabPlnInstall::GetIndex UInt_t  defIndex  )  const [virtual]
 

Reimplemented from DbiTableRow.

Definition at line 270 of file FabPlnInstall.cxx.

References fPlaneId, and PlexPlaneId::GetPlane().

00271 { 
00272   return fPlaneId.GetPlane();
00273 }

const VldTimeStamp& FabPlnInstall::GetInstallDate  )  const [inline]
 

Definition at line 59 of file FabPlnInstall.h.

Referenced by UgliGeometry::BuildNodes(), FabPlnInstallLookup::LookForOddEntries(), FabPlnInstallLookup::NextInstall(), and FabPlnInstallLookup::TimeNextInstall().

00059 { return fInstallDate; }

const PlexPlaneId& FabPlnInstall::GetPlaneId  )  const [inline]
 

Definition at line 58 of file FabPlnInstall.h.

Referenced by FabPlnInstallLookup::FabPlnInstallLookup(), FabPlnInstallLookup::LookForOddEntries(), FabPlnInstallLookup::NextInstall(), FabPlnInstallLookup::WhereIsScintMdl(), and FabPlnInstallLookup::WhereIsSteelSlab().

00058 { return fPlaneId; }

string FabPlnInstall::GetScintMdlMfgId UShort_t  indx  )  const
 

Definition at line 249 of file FabPlnInstall.cxx.

References fScintMdlMfgId.

Referenced by FabPlnInstallLookup::GetScintMdlMfgId(), FabPlnInstallLookup::LookForOddEntries(), and FabPlnInstallLookup::WhereIsScintMdl().

00250 { 
00251   if (indx > fScintMdlMfgId.size()) return "no-scint-id";
00252   return fScintMdlMfgId[indx];
00253 }

string FabPlnInstall::GetSteelSlabMfgId UShort_t  indx  )  const
 

Definition at line 256 of file FabPlnInstall.cxx.

References fSteelSlabMfgId.

Referenced by FabPlnInstallLookup::GetFabSteelPlates(), FabPlnInstallLookup::GetSteelSlabMfgId(), FabPlnInstallLookup::LookForOddEntries(), and FabPlnInstallLookup::WhereIsSteelSlab().

00257 { 
00258   if (indx > fSteelSlabMfgId.size()) return "no-slab-id";
00259   return fSteelSlabMfgId[indx];
00260 }

const char * FabPlnInstall::GetTableDescr  )  [static]
 

Definition at line 312 of file FabPlnInstall.cxx.

00313 {
00314 //
00315 //
00316 //  Purpose:  Return a string describing rows in the table
00317 //            Used in creating temporary tables
00318 //
00319 //  Return:   const char* to parenthesized comma separated list
00320 //            of column name and type pairs
00321 //
00322 //  Contact:   R. Hatcher
00323 //
00324 //  Specification:-
00325 //  =============
00326 //
00327 
00328 //  Program Notes:-
00329 //  =============
00330 
00331 //  None.
00332 
00333    const char* const_tabledescr = "(\
00334        SEQNO             int,      \
00335        ROW_COUNTER       int,      \
00336        INSTALLDATE       datetime, \
00337        MODULEID1         tinytext, \
00338        MODULEID2         tinytext, \
00339        MODULEID3         tinytext, \
00340        MODULEID4         tinytext, \
00341        MODULEID5         tinytext, \
00342        MODULEID6         tinytext, \
00343        MODULEID7         tinytext, \
00344        MODULEID8         tinytext, \
00345        STEELID1          tinytext, \
00346        STEELID2          tinytext, \
00347        STEELID3          tinytext, \
00348        STEELID4          tinytext, \
00349        STEELID5          tinytext, \
00350        STEELID6          tinytext, \
00351        STEELID7          tinytext, \
00352        STEELID8          tinytext, \
00353        PLANENUM          int,      \
00354        primary key (SEQNO,ROW_COUNTER) \
00355        )";
00356 
00357    return const_tabledescr;
00358 }

void FabPlnInstall::Print Option_t *  option = ""  )  const [virtual]
 

Definition at line 280 of file FabPlnInstall.cxx.

References FormatToOStream(), and option.

00281 { FormatToOStream(cout,option); }

void FabPlnInstall::SetDefensiveUnpkg Bool_t  defensive  )  [inline, static]
 

Definition at line 81 of file FabPlnInstall.h.

References fgDefensiveUnpkg.

00082      { fgDefensiveUnpkg = defensive; }

void FabPlnInstall::Store DbiOutRowStream ors,
const DbiValidityRec vrec
const [virtual]
 

Reimplemented from DbiTableRow.

Definition at line 161 of file FabPlnInstall.cxx.

References fPlaneId, fScintMdlMfgId, fSteelSlabMfgId, PlexPlaneId::GetPlane(), and MSG.

00162                                                                   {
00163 //
00164 //
00165 //  Purpose:  Stream object to output row stream
00166 //
00167 //  Arguments: 
00168 //    ors          in     Output row stream.
00169 //    vrec         in     Associated validity record (or 0 if filling
00170 //                                                    DbiValidityRec)
00171 //
00172 //  Return:    
00173 //
00174 //  Contact:   R. Hatcher
00175 //
00176 //  Specification:-
00177 //  =============
00178 //
00179 //  o  Stream object to output row stream.
00180 
00181 //  Program Notes:-
00182 //  =============
00183 
00184 //  None.
00185 
00186   //const char* tabledescr = GetTableDescr();
00187    //   vector< pair<string,string> > components = 
00188    //      UgliDbiTableDescr::ParseTableDescr(tabledescr);
00189    //   int n = components.size();
00190    vector< pair<string,string> > components;
00191    components.push_back(pair<string,string>("SEQNO","int"));
00192    components.push_back(pair<string,string>("INSTALLDATE","datetime"));
00193    components.push_back(pair<string,string>("MODULEID1","tinytext"));
00194    components.push_back(pair<string,string>("MODULEID2","tinytext"));
00195    components.push_back(pair<string,string>("MODULEID3","tinytext"));
00196    components.push_back(pair<string,string>("MODULEID4","tinytext"));
00197    components.push_back(pair<string,string>("MODULEID5","tinytext"));
00198    components.push_back(pair<string,string>("MODULEID6","tinytext"));
00199    components.push_back(pair<string,string>("MODULEID7","tinytext"));
00200    components.push_back(pair<string,string>("MODULEID8","tinytext"));
00201    components.push_back(pair<string,string>("STEELID1","tinytext"));
00202    components.push_back(pair<string,string>("STEELID2","tinytext"));
00203    components.push_back(pair<string,string>("STEELID3","tinytext"));
00204    components.push_back(pair<string,string>("STEELID4","tinytext"));
00205    components.push_back(pair<string,string>("STEELID5","tinytext"));
00206    components.push_back(pair<string,string>("STEELID6","tinytext"));
00207    components.push_back(pair<string,string>("STEELID7","tinytext"));
00208    components.push_back(pair<string,string>("STEELID8","tinytext"));
00209    components.push_back(pair<string,string>("PLANENUM","int"));
00210    int n = components.size();
00211 
00212    for (int i=0; i<n; i++) {
00213       pair<string,string> colPair = components[i];
00214       string colName = colPair.first;
00215       if (      colName == "INSTALLDATE") ors << fInstallDate;
00216 
00217       // note! indexing uses zero-based, but naming is 1..8
00218       else if ( colName == "MODULEID1")   ors << fScintMdlMfgId[0];
00219       else if ( colName == "MODULEID2")   ors << fScintMdlMfgId[1];
00220       else if ( colName == "MODULEID3")   ors << fScintMdlMfgId[2];
00221       else if ( colName == "MODULEID4")   ors << fScintMdlMfgId[3];
00222       else if ( colName == "MODULEID5")   ors << fScintMdlMfgId[4];
00223       else if ( colName == "MODULEID6")   ors << fScintMdlMfgId[5];
00224       else if ( colName == "MODULEID7")   ors << fScintMdlMfgId[6];
00225       else if ( colName == "MODULEID8")   ors << fScintMdlMfgId[7];
00226 
00227       else if ( colName == "STEELID1")    ors << fSteelSlabMfgId[0];
00228       else if ( colName == "STEELID2")    ors << fSteelSlabMfgId[1];
00229       else if ( colName == "STEELID3")    ors << fSteelSlabMfgId[2];
00230       else if ( colName == "STEELID4")    ors << fSteelSlabMfgId[3];
00231       else if ( colName == "STEELID5")    ors << fSteelSlabMfgId[4];
00232       else if ( colName == "STEELID6")    ors << fSteelSlabMfgId[5];
00233       else if ( colName == "STEELID7")    ors << fSteelSlabMfgId[6];
00234       else if ( colName == "STEELID8")    ors << fSteelSlabMfgId[7];
00235 
00236       else if ( colName == "PLANENO")     ors << fPlaneId.GetPlane();
00237 
00238       else if ( colName == "ROW_COUNTER"     ) {;}
00239       else if ( colName == "SEQNO"           ) {;}
00240       else {
00241          MSG("Fab",Msg::kFatal)
00242             << "Column name '" << colName << "' not correctly handled" << endl;
00243          assert(0);
00244       }
00245    }
00246 }


Member Data Documentation

Bool_t FabPlnInstall::fgDefensiveUnpkg = kFALSE [static, private]
 

Definition at line 37 of file FabPlnInstall.cxx.

Referenced by SetDefensiveUnpkg().

VldTimeStamp FabPlnInstall::fInstallDate [private]
 

Definition at line 95 of file FabPlnInstall.h.

Referenced by FabPlnInstall(), and FormatToOStream().

PlexPlaneId FabPlnInstall::fPlaneId [private]
 

Definition at line 94 of file FabPlnInstall.h.

Referenced by FabPlnInstall(), FormatToOStream(), GetAggregateNo(), GetIndex(), and Store().

std::vector<std::string> FabPlnInstall::fScintMdlMfgId [private]
 

Definition at line 96 of file FabPlnInstall.h.

Referenced by FabPlnInstall(), FormatToOStream(), GetScintMdlMfgId(), and Store().

std::vector<std::string> FabPlnInstall::fSteelSlabMfgId [private]
 

Definition at line 97 of file FabPlnInstall.h.

Referenced by FabPlnInstall(), FormatToOStream(), GetSteelSlabMfgId(), and Store().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:09:09 2010 for loon by  doxygen 1.3.9.1