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

static const char * GetTableDescr ()
static void SetDefensiveUnpkg (Bool_t defensive)
static 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

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 32 of file FabPlnInstall.h.


Constructor & Destructor Documentation

FabPlnInstall::FabPlnInstall (  )  [inline]

Definition at line 39 of file FabPlnInstall.h.

References fScintMdlMfgId, fSteelSlabMfgId, and LEA_CTOR.

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.

References LEA_DTOR.

00054 { LEA_DTOR; };

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

Definition at line 89 of file FabPlnInstall.h.

References LEA_CTOR.

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 DbiRowStream::CurColName(), DbiRowStream::CurColNum(), det, fgDefensiveUnpkg, fInstallDate, fPlaneId, fScintMdlMfgId, fSteelSlabMfgId, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), Nav::kBoth, Msg::kWarning, MSG, DbiRowStream::NumCols(), 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) {
00114               MSG("Fab",Msg::kWarning) 
00115                 << "Ignoring column " << rs.CurColNum() 
00116                 << " (of " << rs.NumCols() << ")"
00117                 << " \""<< colName << "\"; not part of "
00118                 << ClassName() << endl;
00119             }
00120             rs.IncrementCurCol();
00121          }
00122       }
00123    } // end defensive unpacking
00124    else {
00125       rs >> fInstallDate
00126          >> fScintMdlMfgId[0]
00127          >> fScintMdlMfgId[1]
00128          >> fScintMdlMfgId[2]
00129          >> fScintMdlMfgId[3]
00130          >> fScintMdlMfgId[4]
00131          >> fScintMdlMfgId[5]
00132          >> fScintMdlMfgId[6]
00133          >> fScintMdlMfgId[7]
00134          >> fSteelSlabMfgId[0]
00135          >> fSteelSlabMfgId[1]
00136          >> fSteelSlabMfgId[2]
00137          >> fSteelSlabMfgId[3]
00138          >> fSteelSlabMfgId[4]
00139          >> fSteelSlabMfgId[5]
00140          >> fSteelSlabMfgId[6]
00141          >> fSteelSlabMfgId[7]
00142          >> ipln;
00143     }
00144 
00145     // trim off lead/trailing blanks
00146     for (UInt_t i=0; i < 8; ++i ) {
00147       fScintMdlMfgId[i]  = 
00148         ToUpper(fScintMdlMfgId[i]).Strip(TString::kBoth).Data();
00149       fSteelSlabMfgId[i] = 
00150         ToUpper(fSteelSlabMfgId[i]).Strip(TString::kBoth).Data();
00151     }
00152 
00153     Detector::Detector_t det =
00154       (Detector::Detector_t) 
00155       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00156 
00157     fPlaneId = PlexPlaneId(det,ipln,kTRUE); // steel can be uninstrumented
00158 
00159 }

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

Definition at line 286 of file FabPlnInstall.cxx.

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

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

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

Int_t FabPlnInstall::GetAggregateNo (  )  const [virtual]

Reimplemented from DbiTableRow.

Definition at line 265 of file FabPlnInstall.cxx.

References fPlaneId, and PlexPlaneId::GetPlane().

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

static Bool_t FabPlnInstall::GetDefensiveUnpkg (  )  [inline, static]

Definition at line 83 of file FabPlnInstall.h.

References fgDefensiveUnpkg.

00083 { return fgDefensiveUnpkg; }

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

Reimplemented from DbiTableRow.

Definition at line 272 of file FabPlnInstall.cxx.

References fPlaneId, and PlexPlaneId::GetPlane().

00273 { 
00274   return fPlaneId.GetPlane();
00275 }

const VldTimeStamp& FabPlnInstall::GetInstallDate (  )  const [inline]
const PlexPlaneId& FabPlnInstall::GetPlaneId (  )  const [inline]
string FabPlnInstall::GetScintMdlMfgId ( UShort_t  indx  )  const

Definition at line 251 of file FabPlnInstall.cxx.

References fScintMdlMfgId.

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

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

string FabPlnInstall::GetSteelSlabMfgId ( UShort_t  indx  )  const

Definition at line 258 of file FabPlnInstall.cxx.

References fSteelSlabMfgId.

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

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

const char * FabPlnInstall::GetTableDescr (  )  [static]

Definition at line 314 of file FabPlnInstall.cxx.

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

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

Definition at line 282 of file FabPlnInstall.cxx.

References FormatToOStream().

00283 { FormatToOStream(cout,option); }

static 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 163 of file FabPlnInstall.cxx.

References fInstallDate, fPlaneId, fScintMdlMfgId, fSteelSlabMfgId, PlexPlaneId::GetPlane(), Msg::kFatal, MSG, and n.

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


Member Data Documentation

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

Definition at line 101 of file FabPlnInstall.h.

Referenced by Fill(), GetDefensiveUnpkg(), and SetDefensiveUnpkg().

Definition at line 95 of file FabPlnInstall.h.

Referenced by Fill(), FormatToOStream(), GetInstallDate(), and Store().

Definition at line 94 of file FabPlnInstall.h.

Referenced by Fill(), FormatToOStream(), GetAggregateNo(), GetIndex(), GetPlaneId(), and Store().

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

Definition at line 96 of file FabPlnInstall.h.

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

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

Definition at line 97 of file FabPlnInstall.h.

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


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1