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

PlexStripEndToLed.cxx

Go to the documentation of this file.
00001 
00002 // $Id: PlexStripEndToLed.cxx,v 1.5 2005/08/26 18:47:04 rhatcher Exp $
00003 //
00004 // PlexStripEndToLed
00005 //
00006 // Package: Plex
00007 //
00008 // R. Hatcher  2002-04-06
00009 //
00010 // Concept:
00011 //   
00012 // Purpose:
00013 //
00015 
00016 #include "Plex/PlexStripEndToLed.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 #include "Plex/PlexLoanPool.h"
00022 
00023 ClassImp(PlexStripEndToLed)
00024 
00025 //   Definition of static data members
00026 //   *********************************
00027 
00028 CVSID("$Id: PlexStripEndToLed.cxx,v 1.5 2005/08/26 18:47:04 rhatcher Exp $ CVSID_DBIRESULTPTR ");
00029 Bool_t PlexStripEndToLed::fgDefensiveUnpkg = kFALSE;
00030 
00031 //  Instantiate associated Result Pointer class.
00032 //  *******************************************
00033 
00034 #include "DatabaseInterface/DbiResultPtr.tpl"
00035 template class  DbiResultPtr<PlexStripEndToLed>;
00036 
00037 #include "DatabaseInterface/DbiWriter.tpl"
00038 template class  DbiWriter<PlexStripEndToLed>;
00039 
00040 // Definition of member functions (alphabetical order)
00041 // ***************************************************
00042 
00043 void PlexStripEndToLed::Fill(DbiResultSet& rs,
00044                                    const DbiValidityRec* vrec) {
00045 //
00046 //
00047 //  Purpose:  Fill object from Result Set
00048 //
00049 //  Arguments: 
00050 //    rs           in    Result Set used to fill object
00051 //    vrec         in    Associated validity record (or 0 if filling
00052 //                                                    DbiValidityRec)
00053 //
00054 //  Return:    
00055 //
00056 //  Contact:   R. Hatcher
00057 //
00058 //  Specification:-
00059 //  =============
00060 //
00061 //  o Fill object from current row of Result Set.
00062 
00063 //  Program Notes:-
00064 //  =============
00065 
00066 //  None.
00067 
00068    Detector::Detector_t det =
00069       (Detector::Detector_t) 
00070       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00071    
00072    int    plane, strip, pulserBox, ledInBox;
00073    char   endchar;
00074 
00075    if (fgDefensiveUnpkg) {
00076 
00077       // unpack allowing for various column names and ordering
00078 
00079       Int_t numCol = rs.NumCols();
00080       //  The first column (SeqNo) has already been processed.
00081       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00082          string colName = rs.CurColName();
00083          if (      colName == "AGGREGATENO" ) rs >> fAggregate;
00084          else if ( colName == "PLANE"       ) rs >> plane;
00085          else if ( colName == "STRIP"       ) rs >> strip;
00086          else if ( colName == "STRIPEND"    ) rs >> endchar;
00087          else if ( colName == "PULSERBOX"   ) rs >> pulserBox;
00088          else if ( colName == "LEDINBOX"    ) rs >> ledInBox;
00089          else {
00090             static int nmsg = 25;
00091             if (nmsg-- > 0) MSG("Plex",Msg::kWarning) 
00092                << "Ignoring column " << rs.CurColNum() 
00093                << " (of " << rs.NumCols() << ")"
00094                << " \""<< colName << "\"; not part of "
00095                << ClassName() << endl;
00096             rs.IncrementCurCol();
00097          }
00098       }
00099    } // end defensive unpacking
00100    else {
00101 //       SeqNo         int,
00102 //       AggregateNo   int,
00103 //       Plane         smallint,
00104 //       Strip         smallint,
00105 //       StripEnd      char(1)
00106 //       PulserBox     tinyint,
00107 //       LedInBox      tinyint
00108 
00109       rs >> fAggregate
00110          >> plane
00111          >> strip
00112          >> endchar
00113          >> pulserBox
00114          >> ledInBox;
00115       
00116    }
00117    
00118    StripEnd::StripEnd_t end  = StripEnd::CharToEnum(endchar);
00119 
00120    fPlexStripEndId = PlexStripEndId(det,plane,strip,end);
00121    fPlexLedId      = PlexLedId(det,pulserBox,ledInBox);
00122 
00123 }
00124 //.....................................................................
00125 
00126 void PlexStripEndToLed::Store(DbiOutRowStream& ors,
00127                               const DbiValidityRec* /* vrec */) const {
00128 //
00129 //
00130 //  Purpose:  Stream object to output row stream
00131 //
00132 //  Arguments: 
00133 //    ors          in     Output row stream.
00134 //    vrec         in     Associated validity record (or 0 if filling
00135 //                                                    DbiValidityRec)
00136 //
00137 //  Return:    
00138 //
00139 //  Contact:   R. Hatcher
00140 //
00141 //  Specification:-
00142 //  =============
00143 //
00144 //  o  Stream object to output row stream.
00145 
00146 //  Program Notes:-
00147 //  =============
00148 
00149 //  None.
00150 
00151    ors << fAggregate 
00152        << fPlexStripEndId.GetPlane()
00153        << fPlexStripEndId.GetStrip()
00154        << StripEnd::AsString(fPlexStripEndId.GetEnd())[0]
00155        << fPlexLedId.GetPulserBox()
00156        << fPlexLedId.GetLedInBox();
00157    
00158 }
00159 
00160 /*    Template for New Member Function
00161 
00162 //.....................................................................
00163 
00164 PlexStripEndToLed:: {
00165 //
00166 //
00167 //  Purpose:  
00168 //
00169 //  Arguments: 
00170 //    xxxxxxxxx    in    yyyyyy
00171 //
00172 //  Return:    
00173 //
00174 //  Contact:   R. Hatcher
00175 //
00176 //  Specification:-
00177 //  =============
00178 //
00179 //  o 
00180 
00181 //  Program Notes:-
00182 //  =============
00183 
00184 //  None.
00185 
00186 
00187 }
00188 
00189 */
00190 

Generated on Mon Feb 15 11:07:23 2010 for loon by  doxygen 1.3.9.1