UgliDbiScintMdlStruct Class Reference

#include <UgliDbiScintMdlStruct.h>

Inheritance diagram for UgliDbiScintMdlStruct:

DbiTableRow List of all members.

Public Member Functions

 UgliDbiScintMdlStruct ()
 UgliDbiScintMdlStruct (PlexScintMdlId scintmdlid, std::string type, Short_t first, Short_t last)
 UgliDbiScintMdlStruct (Detector::Detector_t detector, PlaneView::PlaneView_t view, PlaneCoverage::PlaneCoverage_t coverage, UShort_t module, std::string type, Short_t first, Short_t last)
virtual ~UgliDbiScintMdlStruct ()
UInt_t GetIndex (UInt_t defIndex) const
Detector::Detector_t GetDetector () const
PlaneView::PlaneView_t GetPlaneView () const
PlaneCoverage::PlaneCoverage_t GetPlaneCoverage () const
UShort_t GetModule () const
std::string GetTypeName () const
Short_t GetFirstStrip () const
Short_t GetLastStrip () const
virtual DbiTableRowCreateTableRow () const
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="", const DbiValidityRec *vrec=0) const
virtual void Print (Option_t *option="") const

Static Public Member Functions

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

Private Member Functions

 UgliDbiScintMdlStruct (const UgliDbiScintMdlStruct &from)

Private Attributes

UgliDbiStructHash fDetViewCoverMdl
std::string fTypeName
Int_t fFirstStrip
Int_t fLastStrip

Static Private Attributes

static Bool_t fgDefensiveUnpkg = kFALSE

Detailed Description

Definition at line 28 of file UgliDbiScintMdlStruct.h.


Constructor & Destructor Documentation

UgliDbiScintMdlStruct::UgliDbiScintMdlStruct (  )  [inline]

Definition at line 35 of file UgliDbiScintMdlStruct.h.

References LEA_CTOR.

00036       : fDetViewCoverMdl(), fTypeName("unknown"), 
00037         fFirstStrip(-1), fLastStrip(-1) { LEA_CTOR; };

UgliDbiScintMdlStruct::UgliDbiScintMdlStruct ( PlexScintMdlId  scintmdlid,
std::string  type,
Short_t  first,
Short_t  last 
) [inline]

Definition at line 39 of file UgliDbiScintMdlStruct.h.

References LEA_CTOR.

00041       : fDetViewCoverMdl(scintmdlid), fTypeName(type), 
00042         fFirstStrip(first), fLastStrip(last) { LEA_CTOR; };

UgliDbiScintMdlStruct::UgliDbiScintMdlStruct ( Detector::Detector_t  detector,
PlaneView::PlaneView_t  view,
PlaneCoverage::PlaneCoverage_t  coverage,
UShort_t  module,
std::string  type,
Short_t  first,
Short_t  last 
) [inline]

Definition at line 44 of file UgliDbiScintMdlStruct.h.

References LEA_CTOR.

00049       : fDetViewCoverMdl(detector,view,coverage,module), fTypeName(type), 
00050         fFirstStrip(first), fLastStrip(last) { LEA_CTOR; };

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

Definition at line 52 of file UgliDbiScintMdlStruct.h.

References LEA_DTOR.

00052 { LEA_DTOR; };

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

Definition at line 91 of file UgliDbiScintMdlStruct.h.

References LEA_CTOR.

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


Member Function Documentation

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

Implements DbiTableRow.

Definition at line 68 of file UgliDbiScintMdlStruct.h.

00068 { return new UgliDbiScintMdlStruct; }

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

Implements DbiTableRow.

Definition at line 58 of file UgliDbiScintMdlStruct.cxx.

References DbiRowStream::CurColName(), DbiRowStream::CurColNum(), det, fDetViewCoverMdl, fFirstStrip, fgDefensiveUnpkg, fLastStrip, fTypeName, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), PlaneCoverage::kUnknown, PlaneView::kUnknown, Msg::kWarning, MSG, and DbiRowStream::NumCols().

00059                                                                   {
00060 //
00061 //
00062 //  Purpose:  Fill object from Result Set
00063 //
00064 //  Arguments: 
00065 //    rs           in    Result Set used to fill object
00066 //    vrec         in    Associated validity record (or 0 if filling
00067 //                                                    DbiValidityRec)
00068 //
00069 //  Return:    
00070 //
00071 //  Contact:   R. Hatcher
00072 //
00073 //  Specification:-
00074 //  =============
00075 //
00076 //  o Fill object from current row of Result Set.
00077 
00078 //  Program Notes:-
00079 //  =============
00080 
00081 //  None.
00082 
00083    Detector::Detector_t det =
00084       (Detector::Detector_t) 
00085       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00086 
00087    UInt_t   hashv = 0;
00088    UInt_t   tmpdet = det;
00089    UInt_t   tmpview = PlaneView::kUnknown;
00090     Int_t   tmpcoverage = PlaneCoverage::kUnknown;
00091    UShort_t mdlinpln = 0xffff;
00092 
00093    if (fgDefensiveUnpkg) {
00094 
00095       // unpack allowing for various column names and ordering
00096 
00097       Int_t numCol = rs.NumCols();
00098       //  The first column (SeqNo) has already been processed.
00099       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00100          string colName = rs.CurColName();
00101          if (      colName == "HASHVAL"   ) rs.IncrementCurCol();
00102          else if ( colName == "DETECTOR"  ) rs >> tmpdet;
00103          else if ( colName == "PLNVIEW"   ) rs >> tmpview;
00104          else if ( colName == "COVERAGE"  ) rs >> tmpcoverage;
00105          else if ( colName == "MDLINPLANE") rs >> mdlinpln;
00106          else if ( colName == "TYPENAME"  ) rs >> fTypeName;
00107          else if ( colName == "FIRSTSTRIP") rs >> fFirstStrip;
00108          else if ( colName == "LASTSTRIP" ) rs >> fLastStrip;
00109          else {
00110             static int nmsg = 25;
00111             if (nmsg-- > 0) {
00112               MSG("Ugli",Msg::kWarning) 
00113                 << "Ignoring column " << rs.CurColNum() 
00114                 << " (of " << rs.NumCols() << ")"
00115                 << " \""<< colName << "\"; not part of "
00116                 << ClassName() << endl;
00117             }
00118             rs.IncrementCurCol();
00119          }
00120       }      
00121    } // end defensive unpacking
00122    else {
00123       rs >> hashv
00124          >> tmpdet
00125          >> tmpview
00126          >> tmpcoverage
00127          >> mdlinpln
00128          >> fTypeName
00129          >> fFirstStrip
00130          >> fLastStrip;
00131    }      
00132 
00133    fDetViewCoverMdl =
00134      UgliDbiStructHash( (Detector::Detector_t)tmpdet,
00135                         (PlaneView::PlaneView_t)tmpview,
00136                         (PlaneCoverage::PlaneCoverage_t)tmpcoverage,
00137                         mdlinpln );
00138       
00139 }

std::ostream & UgliDbiScintMdlStruct::FormatToOStream ( std::ostream &  os,
Option_t *  option = "",
const DbiValidityRec vrec = 0 
) const [virtual]

Definition at line 208 of file UgliDbiScintMdlStruct.cxx.

References fFirstStrip, fLastStrip, fTypeName, GetDetector(), GetModule(), GetPlaneCoverage(), GetPlaneView(), DbiValidityRec::GetSeqNo(), GetTableDescr(), UgliDbiTableDescr::ParseTableDescr(), and UgliDbiTableDescr::TextTableDescrLine().

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

00211 {
00212 //
00213 //
00214 //  Purpose:  Print the current row
00215 //
00216 //  Return:   nothing
00217 //
00218 //  Contact:   R. Hatcher
00219 //
00220 //  Specification:-
00221 //  =============
00222 //
00223 
00224 //  Program Notes:-
00225 //  =============
00226 
00227 //  None.
00228 
00229   string opt = option;
00230 
00231   if ( opt.find("H") != string::npos ) {
00232      string tabledescr = GetTableDescr();
00233      tabledescr = UgliDbiTableDescr::TextTableDescrLine(tabledescr);
00234      os << tabledescr << endl;
00235   }
00236   else if ( opt.find("h") != string::npos ) {
00237     string tabledescr = GetTableDescr();
00238     vector< pair<string,string> > components = 
00239         UgliDbiTableDescr::ParseTableDescr(tabledescr);
00240     for (unsigned int ic = 0; ic < components.size(); ++ic) 
00241         os << components[ic].first << '\t';
00242     os << endl;
00243   }
00244 
00245   char sep = '\t';
00246   if ( opt.find(",") != string::npos ) sep = ',';
00247 
00248   if ( ! dvr ) {
00249       os << "SeqNo"         << sep;  // no way of knowing the SEQNO?
00250   }
00251   else {
00252       os << dvr->GetSeqNo() << sep;
00253   }
00254 
00255   os   << "ROW_COUNTER" << sep  // ???
00256        << -1            << sep  // Hashval is obsolete
00257        << (int)GetDetector()      << sep
00258        << (int)GetPlaneView()     << sep
00259        << (int)GetPlaneCoverage() << sep
00260        << GetModule()             << sep
00261        << "'" << fTypeName << "'" << sep
00262        << fFirstStrip             << sep
00263        << fLastStrip              << endl;
00264 
00265   return os;
00266 }

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

Definition at line 85 of file UgliDbiScintMdlStruct.h.

References fgDefensiveUnpkg.

00085 { return fgDefensiveUnpkg; }

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

Definition at line 109 of file UgliDbiScintMdlStruct.h.

References fDetViewCoverMdl, and UgliDbiStructHash::GetDetector().

Referenced by FormatToOStream().

00110 { return fDetViewCoverMdl.GetDetector(); }

Short_t UgliDbiScintMdlStruct::GetFirstStrip (  )  const [inline]

Definition at line 64 of file UgliDbiScintMdlStruct.h.

References fFirstStrip.

Referenced by UgliScintPlnNode::BuildStrips(), and UgliGeometryReroot::MakeTempDbiPosInfo().

00064 { return fFirstStrip; }

UInt_t UgliDbiScintMdlStruct::GetIndex ( UInt_t  defIndex  )  const [inline, virtual]

Reimplemented from DbiTableRow.

Definition at line 121 of file UgliDbiScintMdlStruct.h.

References fDetViewCoverMdl, and UgliDbiStructHash::HashAsScintMdl().

Referenced by UgliGeometryReroot::MakeTempDbiScintStruct(), and Store().

00122 { return fDetViewCoverMdl.HashAsScintMdl(); }

Short_t UgliDbiScintMdlStruct::GetLastStrip (  )  const [inline]

Definition at line 65 of file UgliDbiScintMdlStruct.h.

References fLastStrip.

Referenced by UgliScintPlnNode::BuildStrips(), and UgliGeometryReroot::MakeTempDbiPosInfo().

00065 { return fLastStrip; }

UShort_t UgliDbiScintMdlStruct::GetModule (  )  const [inline]

Definition at line 118 of file UgliDbiScintMdlStruct.h.

References fDetViewCoverMdl, and UgliDbiStructHash::GetPart().

Referenced by FormatToOStream().

00119 { return fDetViewCoverMdl.GetPart(); }

PlaneCoverage::PlaneCoverage_t UgliDbiScintMdlStruct::GetPlaneCoverage (  )  const [inline]

Definition at line 115 of file UgliDbiScintMdlStruct.h.

References fDetViewCoverMdl, and UgliDbiStructHash::GetPlaneCoverage().

Referenced by FormatToOStream().

00116 { return fDetViewCoverMdl.GetPlaneCoverage(); }

PlaneView::PlaneView_t UgliDbiScintMdlStruct::GetPlaneView (  )  const [inline]

Definition at line 112 of file UgliDbiScintMdlStruct.h.

References fDetViewCoverMdl, and UgliDbiStructHash::GetPlaneView().

Referenced by FormatToOStream().

00113 { return fDetViewCoverMdl.GetPlaneView(); }

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

Definition at line 270 of file UgliDbiScintMdlStruct.cxx.

Referenced by FormatToOStream(), UgliGeometryReroot::MakeTempDbiScintStruct(), and Store().

00271 {
00272 //
00273 //
00274 //  Purpose:  Return a string describing rows in the table
00275 //            Used in creating temporary tables
00276 //
00277 //  Return:   const char* to parenthesized comma separated list
00278 //            of column name and type pairs
00279 //
00280 //  Contact:   R. Hatcher
00281 //
00282 //  Specification:-
00283 //  =============
00284 //
00285 
00286 //  Program Notes:-
00287 //  =============
00288 
00289 //  None.
00290 
00291    const char* const_tabledescr = "(\
00292        SEQNO         int,      \
00293        ROW_COUNTER   int,      \
00294        HASHVAL       int,      \
00295        DETECTOR      tinyint,  \
00296        PLNVIEW       tinyint,  \
00297        COVERAGE      tinyint,  \
00298        MDLINPLANE    tinyint,  \
00299        TYPENAME      text,     \
00300        FIRSTSTRIP    smallint, \
00301        LASTSTRIP     smallint, \
00302        primary key (SEQNO,ROW_COUNTER) \
00303        )";
00304 
00305    return const_tabledescr;
00306 }

std::string UgliDbiScintMdlStruct::GetTypeName (  )  const [inline]

Definition at line 63 of file UgliDbiScintMdlStruct.h.

References fTypeName.

Referenced by UgliScintMdlNode::UgliScintMdlNode().

00063 { return fTypeName; }

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

Definition at line 201 of file UgliDbiScintMdlStruct.cxx.

References FormatToOStream().

00202 {
00203     FormatToOStream(cout,option);
00204 }

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

Definition at line 83 of file UgliDbiScintMdlStruct.h.

References fgDefensiveUnpkg.

00084       { fgDefensiveUnpkg = defensive; }

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

Reimplemented from DbiTableRow.

Definition at line 143 of file UgliDbiScintMdlStruct.cxx.

References fDetViewCoverMdl, fFirstStrip, fLastStrip, fTypeName, UgliDbiStructHash::GetDetector(), GetIndex(), UgliDbiStructHash::GetPart(), UgliDbiStructHash::GetPlaneCoverage(), UgliDbiStructHash::GetPlaneView(), GetTableDescr(), Msg::kFatal, MSG, and UgliDbiTableDescr::ParseTableDescr().

00144                                                                           {
00145 //
00146 //
00147 //  Purpose:  Stream object to output row stream
00148 //
00149 //  Arguments: 
00150 //    ors          in     Output row stream.
00151 //    vrec         in     Associated validity record (or 0 if filling
00152 //                                                    DbiValidityRec)
00153 //
00154 //  Return:    
00155 //
00156 //  Contact:   R. Hatcher
00157 //
00158 //  Specification:-
00159 //  =============
00160 //
00161 //  o  Stream object to output row stream.
00162 
00163 //  Program Notes:-
00164 //  =============
00165 
00166 //  None.
00167 
00168    const char* tabledescr = GetTableDescr();
00169    vector< pair<string,string> > components = 
00170       UgliDbiTableDescr::ParseTableDescr(tabledescr);
00171    int n = components.size();
00172 
00173    for (int i=0; i<n; i++) {
00174       pair<string,string> colPair = components[i];
00175       string colName = colPair.first;
00176       if      ( colName == "HASHVAL"   ) ors << (int)GetIndex(0);
00177       // "HASH" is obsolete
00178       else if ( colName == "HASH"      ) ors << (int)GetIndex(0);
00179       else if ( colName == "DETECTOR"  ) ors << (int)fDetViewCoverMdl.GetDetector();
00180       else if ( colName == "PLNVIEW"   ) ors << (int)fDetViewCoverMdl.GetPlaneView();
00181       // "VIEW" is obsolete
00182       else if ( colName == "VIEW"      ) ors << (int)fDetViewCoverMdl.GetPlaneView();
00183       else if ( colName == "COVERAGE"  ) ors << (int)fDetViewCoverMdl.GetPlaneCoverage();
00184       else if ( colName == "MDLINPLANE") ors << fDetViewCoverMdl.GetPart();
00185       else if ( colName == "TYPENAME"  ) ors << fTypeName;
00186       else if ( colName == "FIRSTSTRIP") ors << fFirstStrip;
00187       else if ( colName == "LASTSTRIP" ) ors << fLastStrip;
00188 
00189       else if ( colName == "ROW_COUNTER"     ) {;}
00190       else if ( colName == "SEQNO"           ) {;}
00191       else {
00192          MSG("Ugli",Msg::kFatal)
00193             << "Column name '" << colName << "' not correctly handled" << endl;
00194          assert(0);
00195       }
00196    }
00197 }


Member Data Documentation

UgliDbiStructHash UgliDbiScintMdlStruct::fDetViewCoverMdl [private]

Definition at line 96 of file UgliDbiScintMdlStruct.h.

Referenced by Fill(), GetDetector(), GetIndex(), GetModule(), GetPlaneCoverage(), GetPlaneView(), and Store().

Int_t UgliDbiScintMdlStruct::fFirstStrip [private]

Definition at line 98 of file UgliDbiScintMdlStruct.h.

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

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

Definition at line 103 of file UgliDbiScintMdlStruct.h.

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

Int_t UgliDbiScintMdlStruct::fLastStrip [private]

Definition at line 99 of file UgliDbiScintMdlStruct.h.

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

std::string UgliDbiScintMdlStruct::fTypeName [private]

Definition at line 97 of file UgliDbiScintMdlStruct.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Sep 1 00:52:54 2014 for loon by  doxygen 1.4.7