FabSteelPlate Class Reference

#include <FabSteelPlate.h>

Inheritance diagram for FabSteelPlate:
DbiTableRow

List of all members.

Public Member Functions

 FabSteelPlate ()
virtual ~FabSteelPlate ()
const std::string & GetSteelSlabMfgId () const
const std::string & GetSteelSlabPartId () const
const std::string & GetSteelSlabHeatId () const
int GetSteelSlabNomWt () const
int GetSteelSlabScaleWt () const
Double_t GetNominalMasskg () const
Double_t GetScaleMasskg () const
Detector::Detector_t GetDetector () 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

Static Public Member Functions

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

Private Member Functions

 FabSteelPlate (const FabSteelPlate &from)

Private Attributes

std::string fSteelSlabMfgId
std::string fSteelSlabPartId
std::string fSteelSlabHeatId
int fSteelSlabNomWt
int fSteelSlabScaleWt
Detector::Detector_t fDetector
int fAggregateNo

Static Private Attributes

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 30 of file FabSteelPlate.h.


Constructor & Destructor Documentation

FabSteelPlate::FabSteelPlate (  )  [inline]

Definition at line 37 of file FabSteelPlate.h.

References LEA_CTOR.

00038     : fSteelSlabMfgId("Serial Number not initialized")
00039     , fSteelSlabPartId ("Part Number not initialized")
00040     , fSteelSlabHeatId("Heat Number not initialized")
00041     , fSteelSlabNomWt(0), fSteelSlabScaleWt(0)
00042     , fDetector(Detector::kUnknown)
00043     { LEA_CTOR; };

virtual FabSteelPlate::~FabSteelPlate (  )  [inline, virtual]

Definition at line 45 of file FabSteelPlate.h.

References LEA_DTOR.

00045 { LEA_DTOR; };

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

Definition at line 80 of file FabSteelPlate.h.

References LEA_CTOR.

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


Member Function Documentation

virtual DbiTableRow* FabSteelPlate::CreateTableRow (  )  const [inline, virtual]

Implements DbiTableRow.

Definition at line 58 of file FabSteelPlate.h.

00058 { return new FabSteelPlate; }

void FabSteelPlate::Fill ( DbiResultSet rs,
const DbiValidityRec vrec 
) [virtual]

Implements DbiTableRow.

Definition at line 57 of file FabSteelPlate.cxx.

References DbiRowStream::CurColName(), DbiRowStream::CurColNum(), fAggregateNo, fDetector, fgDefensiveUnpkg, fSteelSlabHeatId, fSteelSlabMfgId, fSteelSlabNomWt, fSteelSlabPartId, fSteelSlabScaleWt, DbiValidityRec::GetAggregateNo(), VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), Nav::kBoth, Msg::kWarning, MSG, DbiRowStream::NumCols(), and UtilString::ToUpper().

00058                                                                   {
00059 //
00060 //
00061 //  Purpose:  Fill object from Result Set
00062 //
00063 //  Arguments: 
00064 //    rs           in    Result Set used to fill object
00065 //    vrec         in    Associated validity record (or 0 if filling
00066 //                                                    DbiValidityRec)
00067 //
00068 //  Return:    
00069 //
00070 //  Contact:   D. Boehnlein
00071 //
00072 //  Specification:-
00073 //  =============
00074 //
00075 //  o Fill object from current row of Result Set.
00076 
00077 //  Program Notes:-
00078 //  =============
00079 
00080 //  None.
00081 
00082 
00083    if (fgDefensiveUnpkg) {
00084 
00085       // unpack allowing for various column names and ordering
00086 
00087       Int_t numCol = rs.NumCols();
00088       //  The first column (SeqNo) has already been processed.
00089       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00090          string colName = rs.CurColName();
00091          if (      colName == "SERIALNO"  )        rs >> fSteelSlabMfgId;
00092          else if ( colName == "PARTNO")            rs >> fSteelSlabPartId;
00093          else if ( colName == "HEAT")              rs >> fSteelSlabHeatId;
00094          else if ( colName == "NOMINALMASSLBS")    rs >> fSteelSlabNomWt;
00095          else if ( colName == "SCALEMASSLBS")      rs >> fSteelSlabScaleWt;
00096          else {
00097             static int nmsg = 25;
00098             if (nmsg-- > 0) {
00099               MSG("Fab",Msg::kWarning) 
00100                 << "Ignoring column " << rs.CurColNum() 
00101                 << " (of " << rs.NumCols() << ")"
00102                 << " \""<< colName << "\"; not part of "
00103                 << ClassName() << endl;
00104             }
00105             rs.IncrementCurCol();
00106          }
00107       }
00108    } // end defensive unpacking
00109    else {
00110       rs >> fSteelSlabMfgId
00111          >> fSteelSlabPartId
00112          >> fSteelSlabHeatId
00113          >> fSteelSlabNomWt
00114          >> fSteelSlabScaleWt;
00115    }
00116 
00117    // trim off lead/trailing blanks
00118    fSteelSlabMfgId  = ToUpper(fSteelSlabMfgId).Strip(TString::kBoth).Data();
00119    fSteelSlabPartId = ToUpper(fSteelSlabPartId).Strip(TString::kBoth).Data();
00120    fSteelSlabHeatId = ToUpper(fSteelSlabHeatId).Strip(TString::kBoth).Data();
00121 
00122    fDetector =
00123      (Detector::Detector_t) 
00124      ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00125 
00126    fAggregateNo = (vrec) ? vrec->GetAggregateNo() : -1 ;
00127 
00128 }

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

Definition at line 205 of file FabSteelPlate.cxx.

References fSteelSlabHeatId, fSteelSlabMfgId, fSteelSlabNomWt, fSteelSlabPartId, fSteelSlabScaleWt, and Nav::GetName().

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

00207 {
00208   os << GetName() << " " 
00209      << fSteelSlabMfgId << " "
00210      << fSteelSlabPartId << " "
00211      << fSteelSlabHeatId << " "
00212      << fSteelSlabNomWt << " (lbs) "
00213      << fSteelSlabScaleWt << " (lbs) "
00214      << endl;
00215  
00216   os.setf(ios::right);
00217   return os;
00218 }

virtual Int_t FabSteelPlate::GetAggregateNo (  )  const [inline, virtual]

Reimplemented from DbiTableRow.

Definition at line 68 of file FabSteelPlate.h.

References fAggregateNo.

00068 { return fAggregateNo; }

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

Definition at line 74 of file FabSteelPlate.h.

References fgDefensiveUnpkg.

00074 { return fgDefensiveUnpkg; }

Detector::Detector_t FabSteelPlate::GetDetector (  )  const [inline]

Definition at line 56 of file FabSteelPlate.h.

References fDetector.

00056 { return fDetector; }

Double_t FabSteelPlate::GetNominalMasskg (  )  const

Definition at line 185 of file FabSteelPlate.cxx.

References fSteelSlabNomWt, Munits::kilogram, and Munits::pound.

00186 { 
00187   return (double)fSteelSlabNomWt * Munits::pound / Munits::kilogram;
00188 }

Double_t FabSteelPlate::GetScaleMasskg (  )  const

Definition at line 191 of file FabSteelPlate.cxx.

References fSteelSlabScaleWt, Munits::kilogram, and Munits::pound.

00192 { 
00193   return (double)fSteelSlabScaleWt * Munits::pound / Munits::kilogram;
00194 }

const std::string& FabSteelPlate::GetSteelSlabHeatId (  )  const [inline]

Definition at line 51 of file FabSteelPlate.h.

References fSteelSlabHeatId.

00051 { return fSteelSlabHeatId; }

const std::string& FabSteelPlate::GetSteelSlabMfgId (  )  const [inline]

Definition at line 49 of file FabSteelPlate.h.

References fSteelSlabMfgId.

Referenced by FabPlnInstallLookup::GetFabSteelPlates().

00049 { return fSteelSlabMfgId; }

int FabSteelPlate::GetSteelSlabNomWt (  )  const [inline]

Definition at line 52 of file FabSteelPlate.h.

References fSteelSlabNomWt.

00052 { return fSteelSlabNomWt; }

const std::string& FabSteelPlate::GetSteelSlabPartId (  )  const [inline]

Definition at line 50 of file FabSteelPlate.h.

References fSteelSlabPartId.

00050 { return fSteelSlabPartId; }

int FabSteelPlate::GetSteelSlabScaleWt (  )  const [inline]

Definition at line 53 of file FabSteelPlate.h.

References fSteelSlabScaleWt.

00053 { return fSteelSlabScaleWt; }

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

Definition at line 222 of file FabSteelPlate.cxx.

00223 {
00224 //
00225 //
00226 //  Purpose:  Return a string describing rows in the table
00227 //            Used in creating temporary tables
00228 //
00229 //  Return:   const char* to parenthesized comma separated list
00230 //            of column name and type pairs
00231 //
00232 //  Contact:   D. Boehnlein
00233 //
00234 //  Specification:-
00235 //  =============
00236 //
00237 
00238 //  Program Notes:-
00239 //  =============
00240 
00241 //  None.
00242 
00243    const char* const_tabledescr = "(\
00244        SEQNO             int, \
00245        ROW_COUNTER       int, \
00246        SERIALNO          char(8), \
00247        PARTNO            char(8), \
00248        HEAT              char(10), \
00249        NOMINALMASSLBS    int, \
00250        SCALEMASSLBS      int, \
00251        primary key (SEQNO,ROW_COUNTER) \
00252        )";
00253 
00254    return const_tabledescr;
00255 }

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

Definition at line 201 of file FabSteelPlate.cxx.

References FormatToOStream().

00202 { FormatToOStream(cout,option); }

static void FabSteelPlate::SetDefensiveUnpkg ( Bool_t  defensive  )  [inline, static]

Definition at line 72 of file FabSteelPlate.h.

References fgDefensiveUnpkg.

00073      { fgDefensiveUnpkg = defensive; }

void FabSteelPlate::Store ( DbiOutRowStream ors,
const DbiValidityRec vrec 
) const [virtual]

Reimplemented from DbiTableRow.

Definition at line 132 of file FabSteelPlate.cxx.

References fSteelSlabHeatId, fSteelSlabMfgId, fSteelSlabNomWt, fSteelSlabPartId, fSteelSlabScaleWt, Msg::kFatal, MSG, and n.

00133                                                                   {
00134 //
00135 //
00136 //  Purpose:  Stream object to output row stream
00137 //
00138 //  Arguments: 
00139 //    ors          in     Output row stream.
00140 //    vrec         in     Associated validity record (or 0 if filling
00141 //                                                    DbiValidityRec)
00142 //
00143 //  Return:    
00144 //
00145 //  Contact:   D. Boehnlein
00146 //
00147 //  Specification:-
00148 //  =============
00149 //
00150 //  o  Stream object to output row stream.
00151 
00152 //  Program Notes:-
00153 //  =============
00154 
00155 //  None.
00156 
00157    vector< pair<string,string> > components;
00158    components.push_back(pair<string,string>("SEQNO","int"));
00159    components.push_back(pair<string,string>("SERIALNO","char"));
00160    components.push_back(pair<string,string>("PARTNO","char"));
00161    components.push_back(pair<string,string>("HEAT","char"));
00162    components.push_back(pair<string,string>("NOMINALMASSLBS","mediumint"));
00163    components.push_back(pair<string,string>("SCALEMASSLBS","mediumint"));
00164    int n = components.size();
00165 
00166    for (int i=0; i<n; i++) {
00167       pair<string,string> colPair = components[i];
00168       string colName = colPair.first;
00169       if (      colName == "SERIALNO")       ors << fSteelSlabMfgId;
00170       else if ( colName == "PARTNO")         ors << fSteelSlabPartId;
00171       else if ( colName == "HEAT")           ors << fSteelSlabHeatId;
00172       else if ( colName == "NOMINALMASSLBS") ors << fSteelSlabNomWt;
00173       else if ( colName == "SCALEMASSLBS")   ors << fSteelSlabScaleWt;
00174       else if ( colName == "ROW_COUNTER"     ) {;}
00175       else if ( colName == "SEQNO"           ) {;}
00176       else {
00177          MSG("Fab",Msg::kFatal)
00178             << "Column name '" << colName << "' not correctly handled" << endl;
00179          assert(0);
00180       }
00181    }
00182 }


Member Data Documentation

Definition at line 91 of file FabSteelPlate.h.

Referenced by Fill(), and GetAggregateNo().

Definition at line 90 of file FabSteelPlate.h.

Referenced by Fill(), and GetDetector().

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

Definition at line 95 of file FabSteelPlate.h.

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

std::string FabSteelPlate::fSteelSlabHeatId [private]

Definition at line 87 of file FabSteelPlate.h.

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

std::string FabSteelPlate::fSteelSlabMfgId [private]

Definition at line 85 of file FabSteelPlate.h.

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

Definition at line 88 of file FabSteelPlate.h.

Referenced by Fill(), FormatToOStream(), GetNominalMasskg(), GetSteelSlabNomWt(), and Store().

std::string FabSteelPlate::fSteelSlabPartId [private]

Definition at line 86 of file FabSteelPlate.h.

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

Definition at line 89 of file FabSteelPlate.h.

Referenced by Fill(), FormatToOStream(), GetScaleMasskg(), GetSteelSlabScaleWt(), 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