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

UgliDbiScintPlnStruct Class Reference

#include <UgliDbiScintPlnStruct.h>

Inheritance diagram for UgliDbiScintPlnStruct:

DbiTableRow List of all members.

Public Member Functions

 UgliDbiScintPlnStruct ()
 UgliDbiScintPlnStruct (PlexPlaneId plnid, UInt_t nmodules)
 UgliDbiScintPlnStruct (Detector::Detector_t detector, PlaneView::PlaneView_t view, PlaneCoverage::PlaneCoverage_t coverage, Int_t nmodules)
virtual ~UgliDbiScintPlnStruct ()
UInt_t GetIndex (UInt_t defIndex) const
Detector::Detector_t GetDetector () const
PlaneView::PlaneView_t GetPlaneView () const
PlaneCoverage::PlaneCoverage_t GetPlaneCoverage () const
Short_t GetNModules () 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

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

Private Member Functions

 UgliDbiScintPlnStruct (const UgliDbiScintPlnStruct &from)

Private Attributes

UgliDbiStructHash fDetViewCover
UShort_t fNModules

Static Private Attributes

Bool_t fgDefensiveUnpkg = kFALSE

Constructor & Destructor Documentation

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct  )  [inline]
 

Definition at line 35 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and fNModules.

00036       : fDetViewCover(), fNModules(0) { LEA_CTOR; };

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct PlexPlaneId  plnid,
UInt_t  nmodules
[inline]
 

Definition at line 38 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and fNModules.

00039       : fDetViewCover(plnid), fNModules(nmodules) { LEA_CTOR; };

UgliDbiScintPlnStruct::UgliDbiScintPlnStruct Detector::Detector_t  detector,
PlaneView::PlaneView_t  view,
PlaneCoverage::PlaneCoverage_t  coverage,
Int_t  nmodules
[inline]
 

Definition at line 41 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and fNModules.

00045       : fDetViewCover(detector,view,coverage,0),
00046         fNModules(nmodules) { LEA_CTOR; };

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

Definition at line 48 of file UgliDbiScintPlnStruct.h.

00048 { LEA_DTOR; };

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

Definition at line 83 of file UgliDbiScintPlnStruct.h.

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


Member Function Documentation

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

Implements DbiTableRow.

Definition at line 60 of file UgliDbiScintPlnStruct.h.

00060 { return new UgliDbiScintPlnStruct; }

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

Implements DbiTableRow.

Definition at line 60 of file UgliDbiScintPlnStruct.cxx.

References DbiRowStream::CurColName(), DbiRowStream::CurColNum(), det, fDetViewCover, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), MSG, and DbiRowStream::NumCols().

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

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

Definition at line 196 of file UgliDbiScintPlnStruct.cxx.

References fNModules, GetDetector(), GetPlaneCoverage(), GetPlaneView(), DbiValidityRec::GetSeqNo(), GetTableDescr(), UgliDbiTableDescr::ParseTableDescr(), and UgliDbiTableDescr::TextTableDescrLine().

Referenced by Print().

00199 {
00200 //
00201 //
00202 //  Purpose:  Print the current row
00203 //
00204 //  Return:   nothing
00205 //
00206 //  Contact:   R. Hatcher
00207 //
00208 //  Specification:-
00209 //  =============
00210 //
00211 
00212 //  Program Notes:-
00213 //  =============
00214 
00215 //  None.
00216 
00217   string opt = option;
00218 
00219   if ( opt.find("H") != string::npos ) {
00220      string tabledescr = GetTableDescr();
00221      tabledescr = UgliDbiTableDescr::TextTableDescrLine(tabledescr);
00222      os << tabledescr << endl;
00223   }
00224   else if ( opt.find("h") != string::npos ) {
00225     string tabledescr = GetTableDescr();
00226     vector< pair<string,string> > components = 
00227         UgliDbiTableDescr::ParseTableDescr(tabledescr);
00228     for (unsigned int ic = 0; ic < components.size(); ++ic) 
00229         os << components[ic].first << '\t';
00230     os << endl;
00231   }
00232 
00233   char sep = '\t';
00234   if ( opt.find(",") != string::npos ) sep = ',';
00235 
00236   if ( ! dvr ) {
00237       os << "SeqNo"         << sep;  // no way of knowing the SEQNO?
00238   }
00239   else {
00240       os << dvr->GetSeqNo() << sep;
00241   }
00242 
00243   os   << "ROW_COUNTER" << sep  // ???
00244        << -1            << sep  // Hashval is obsolete
00245        << (int)GetDetector()      << sep
00246        << (int)GetPlaneView()     << sep
00247        << (int)GetPlaneCoverage() << sep
00248        << fNModules               << endl;
00249 
00250   return os;
00251 }

Bool_t UgliDbiScintPlnStruct::GetDefensiveUnpkg  )  [inline, static]
 

Definition at line 77 of file UgliDbiScintPlnStruct.h.

00077 { return fgDefensiveUnpkg; }

Detector::Detector_t UgliDbiScintPlnStruct::GetDetector  )  const [inline]
 

Definition at line 99 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and UgliDbiStructHash::GetDetector().

Referenced by UgliScintPlnNode::BuildStrips(), and FormatToOStream().

00100 { return fDetViewCover.GetDetector(); }

UInt_t UgliDbiScintPlnStruct::GetIndex UInt_t  defIndex  )  const [inline, virtual]
 

Reimplemented from DbiTableRow.

Definition at line 111 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and UgliDbiStructHash::HashAsPlane().

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

00112 { return fDetViewCover.HashAsPlane(); }

Short_t UgliDbiScintPlnStruct::GetNModules  )  const [inline]
 

Definition at line 108 of file UgliDbiScintPlnStruct.h.

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

00109 { return fNModules; }

PlaneCoverage::PlaneCoverage_t UgliDbiScintPlnStruct::GetPlaneCoverage  )  const [inline]
 

Definition at line 105 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and UgliDbiStructHash::GetPlaneCoverage().

Referenced by UgliScintPlnNode::BuildStrips(), and FormatToOStream().

00106 { return fDetViewCover.GetPlaneCoverage(); }

PlaneView::PlaneView_t UgliDbiScintPlnStruct::GetPlaneView  )  const [inline]
 

Definition at line 102 of file UgliDbiScintPlnStruct.h.

References fDetViewCover, and UgliDbiStructHash::GetPlaneView().

Referenced by UgliScintPlnNode::BuildStrips(), and FormatToOStream().

00103 { return fDetViewCover.GetPlaneView(); }

const char * UgliDbiScintPlnStruct::GetTableDescr  )  [static]
 

Definition at line 255 of file UgliDbiScintPlnStruct.cxx.

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

00256 {
00257 //
00258 //
00259 //  Purpose:  Return a string describing rows in the table
00260 //            Used in creating temporary tables
00261 //
00262 //  Return:   const char* to parenthesized comma separated list
00263 //            of column name and type pairs
00264 //
00265 //  Contact:   R. Hatcher
00266 //
00267 //  Specification:-
00268 //  =============
00269 //
00270 
00271 //  Program Notes:-
00272 //  =============
00273 
00274 //  None.
00275 
00276    const char* const_tabledescr = "(\
00277        SEQNO         int,     \
00278        ROW_COUNTER   int,     \
00279        HASHVAL       int,     \
00280        DETECTOR      tinyint, \
00281        PLNVIEW       tinyint, \
00282        COVERAGE      tinyint, \
00283        NMODULES      tinyint, \
00284        primary key (SEQNO,ROW_COUNTER) \
00285        )";
00286 
00287    return const_tabledescr;
00288 }

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

Definition at line 189 of file UgliDbiScintPlnStruct.cxx.

References FormatToOStream(), and option.

00190 {
00191     FormatToOStream(cout,option);
00192 }

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

Definition at line 75 of file UgliDbiScintPlnStruct.h.

References fgDefensiveUnpkg.

00076       { fgDefensiveUnpkg = defensive; }

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

Reimplemented from DbiTableRow.

Definition at line 138 of file UgliDbiScintPlnStruct.cxx.

References fDetViewCover, UgliDbiStructHash::GetDetector(), GetIndex(), UgliDbiStructHash::GetPlaneCoverage(), UgliDbiStructHash::GetPlaneView(), GetTableDescr(), MSG, and UgliDbiTableDescr::ParseTableDescr().

00139                                                                           {
00140 //
00141 //
00142 //  Purpose:  Stream object to output row stream
00143 //
00144 //  Arguments: 
00145 //    ors          in     Output row stream.
00146 //    vrec         in     Associated validity record (or 0 if filling
00147 //                                                    DbiValidityRec)
00148 //
00149 //  Return:    
00150 //
00151 //  Contact:   R. Hatcher
00152 //
00153 //  Specification:-
00154 //  =============
00155 //
00156 //  o  Stream object to output row stream.
00157 
00158 //  Program Notes:-
00159 //  =============
00160 
00161 //  None.
00162 
00163    const char* tabledescr = GetTableDescr();
00164    vector< pair<string,string> > components = 
00165       UgliDbiTableDescr::ParseTableDescr(tabledescr);
00166    int n = components.size();
00167 
00168    for (int i=0; i<n; i++) {
00169       pair<string,string> colPair = components[i];
00170       string colName = colPair.first;
00171       if      ( colName == "HASHVAL" ) ors << (int)GetIndex(0);
00172       else if ( colName == "DETECTOR") ors << (int)fDetViewCover.GetDetector();
00173       else if ( colName == "PLNVIEW" ) ors << (int)fDetViewCover.GetPlaneView();
00174       else if ( colName == "COVERAGE") ors << (int)fDetViewCover.GetPlaneCoverage();
00175       else if ( colName == "NMODULES") ors << fNModules;
00176 
00177       else if ( colName == "ROW_COUNTER"     ) {;}
00178       else if ( colName == "SEQNO"           ) {;}
00179       else {
00180          MSG("Ugli",Msg::kFatal)
00181             << "Column name '" << colName << "' not correctly handled" << endl;
00182          assert(0);
00183       }
00184    }
00185 }


Member Data Documentation

UgliDbiStructHash UgliDbiScintPlnStruct::fDetViewCover [private]
 

Definition at line 88 of file UgliDbiScintPlnStruct.h.

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

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

Definition at line 32 of file UgliDbiScintPlnStruct.cxx.

Referenced by SetDefensiveUnpkg().

UShort_t UgliDbiScintPlnStruct::fNModules [private]
 

Definition at line 89 of file UgliDbiScintPlnStruct.h.

Referenced by FormatToOStream(), and UgliDbiScintPlnStruct().


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