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

PlexPinDiodeToLed.cxx

Go to the documentation of this file.
00001 
00002 // $Id: PlexPinDiodeToLed.cxx,v 1.9 2005/08/26 18:47:03 rhatcher Exp $
00003 //
00004 // PlexPinDiodeToLed
00005 //
00006 // Package: Plex
00007 //
00008 // R. Hatcher  2002-04-06
00009 //
00010 // Concept:
00011 //   
00012 // Purpose:
00013 //
00015 
00016 #include "Plex/PlexPinDiodeToLed.h"
00017 #include "MessageService/MsgService.h"
00018 #include "DatabaseInterface/DbiOutRowStream.h"
00019 #include "DatabaseInterface/DbiResultSet.h"
00020 #include "DatabaseInterface/DbiValidityRec.h"
00021 
00022 ClassImp(PlexPinDiodeToLed)
00023 
00024 //   Definition of static data members
00025 //   *********************************
00026 
00027 CVSID("$Id: PlexPinDiodeToLed.cxx,v 1.9 2005/08/26 18:47:03 rhatcher Exp $ CVSID_DBIRESULTPTR ");
00028 Bool_t PlexPinDiodeToLed::fgDefensiveUnpkg = kFALSE;
00029 
00030 //  Instantiate associated Result Pointer class.
00031 //  *******************************************
00032 
00033 #include "DatabaseInterface/DbiResultPtr.tpl"
00034 template class  DbiResultPtr<PlexPinDiodeToLed>;
00035 
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037 template class  DbiWriter<PlexPinDiodeToLed>;
00038 
00039 // Definition of member functions (alphabetical order)
00040 // ***************************************************
00041 
00042 
00043 //.....................................................................
00044 
00045 void PlexPinDiodeToLed::Fill(DbiResultSet& rs,
00046                                       const DbiValidityRec* vrec) {
00047 //
00048 //
00049 //  Purpose:  Fill object from Result Set
00050 //
00051 //  Arguments: 
00052 //    rs           in    Result Set used to fill object
00053 //    vrec         in    Associated validity record (or 0 if filling
00054 //                                                    DbiValidityRec)
00055 //
00056 //  Return:    
00057 //
00058 //  Contact:   R. Hatcher
00059 //
00060 //  Specification:-
00061 //  =============
00062 //
00063 //  o Fill object from current row of Result Set.
00064 
00065 //  Program Notes:-
00066 //  =============
00067 
00068 //  None.
00069 
00070    Detector::Detector_t det =
00071       (Detector::Detector_t) 
00072       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00073 
00074    char   elecName = '?';
00075    char   elecType = ElecType::kUnknown;
00076    char   rackEastWest='?', rackLevel='?';
00077    int    rackBay=0, muxboxInRack=0;
00078    int    diodeinbox=0, gain=0;
00079    int    pulserbox=0, ledinbox=0;
00080 
00081    if (fgDefensiveUnpkg) {
00082 
00083       // unpack allowing for various column names and ordering
00084 
00085       Int_t numCol = rs.NumCols();
00086       //  The first column (SeqNo) has already been processed.
00087       for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00088          string colName = rs.CurColName();
00089          if (      colName == "AGGREGATENO" ) rs >> fAggregate;
00090          else if ( colName == "ELECNAME"    ) rs >> elecName;
00091          else if ( colName == "RACKEASTWEST") rs >> rackEastWest;
00092          else if ( colName == "RACKLEVEL"   ) rs >> rackLevel;
00093          else if ( colName == "RACKBAY"     ) rs >> rackBay;
00094          else if ( colName == "MUXBOXINRACK") rs >> muxboxInRack;
00095          else if ( colName == "DIODEINBOX"  ) rs >> diodeinbox;
00096          else if ( colName == "GAIN"        ) rs >> gain;
00097          else if ( colName == "PULSERBOX"   ) rs >> pulserbox;
00098          else if ( colName == "LEDINBOX"    ) rs >> ledinbox;
00099          else {
00100             static int nmsg = 25;
00101             if (nmsg-- > 0) MSG("Plex",Msg::kWarning) 
00102                << "Ignoring column " << rs.CurColNum() 
00103                << " (of " << rs.NumCols() << ")"
00104                << " \""<< colName << "\"; not part of "
00105                << ClassName() << endl;
00106             rs.IncrementCurCol();
00107          }
00108       }
00109    } // end defensive unpacking
00110    else {
00111 //       SeqNo         int,
00112 //       AggregateNo   int,
00113 //       ElecName      tinytext,
00114 //       RackEastWest  char(1),
00115 //       RackLevel     char(1),
00116 //       RackBay       tinyint,
00117 //       MuxBoxInRack  tinyint,
00118 //       DiodeInBox    tinyint,
00119 //       Gain          tinyint,
00120 //       PulserBox     tinyint,
00121 //       LedInBox      tinyint
00122 
00123       rs >> fAggregate
00124          >> elecName
00125          >> rackEastWest
00126          >> rackLevel
00127          >> rackBay
00128          >> muxboxInRack
00129          >> diodeinbox
00130          >> gain
00131          >> pulserbox
00132          >> ledinbox;
00133 
00134    }
00135 
00136    ElecType::Elec_t elec = ElecType::CharToEnum(elecName);
00137    if (ElecType::kUnknown == elec)  elec = (ElecType::Elec_t) elecType;
00138 
00139    fPlexPinDiodeId = PlexPinDiodeId(det,elec,rackEastWest,rackLevel,
00140                                     rackBay,muxboxInRack,diodeinbox,gain);
00141    fPlexLedId      = PlexLedId(det,pulserbox,ledinbox);
00142 
00143 }
00144 //.....................................................................
00145 
00146 void PlexPinDiodeToLed::Store(DbiOutRowStream& ors,
00147                               const DbiValidityRec* /* vrec */) const {
00148 //
00149 //
00150 //  Purpose:  Stream object to output row stream
00151 //
00152 //  Arguments: 
00153 //    ors          in     Output row stream.
00154 //    vrec         in     Associated validity record (or 0 if filling
00155 //                                                    DbiValidityRec)
00156 //
00157 //  Return:    
00158 //
00159 //  Contact:   R. Hatcher
00160 //
00161 //  Specification:-
00162 //  =============
00163 //
00164 //  o  Stream object to output row stream.
00165 
00166 //  Program Notes:-
00167 //  =============
00168 
00169 //  None.
00170 
00171    ElecType::Elec_t elec = fPlexPinDiodeId.GetElecType();
00172    //   int  numeric      = fPlexPinDiodeId.GetNumericMuxBox();
00173    char rackEastWest = fPlexPinDiodeId.GetEastWest();
00174    char rackLevel    = fPlexPinDiodeId.GetRackLevel();
00175    int  rackBay      = fPlexPinDiodeId.GetRackBay();
00176    int  muxInRack    = fPlexPinDiodeId.GetInRack();
00177 
00178 
00179    ors << fAggregate
00180        << ElecType::AsString(elec)
00181        << rackEastWest
00182        << rackLevel
00183        << rackBay
00184        << muxInRack
00185        << fPlexPinDiodeId.GetInBox()
00186        << fPlexPinDiodeId.GetGain()
00187        << fPlexLedId.GetPulserBox()
00188        << fPlexLedId.GetLedInBox();
00189 }
00190 
00191 /*    Template for New Member Function
00192 
00193 //.....................................................................
00194 
00195 PlexPinDiodeToLed:: {
00196 //
00197 //
00198 //  Purpose:  
00199 //
00200 //  Arguments: 
00201 //    xxxxxxxxx    in    yyyyyy
00202 //
00203 //  Return:    
00204 //
00205 //  Contact:   R. Hatcher
00206 //
00207 //  Specification:-
00208 //  =============
00209 //
00210 //  o 
00211 
00212 //  Program Notes:-
00213 //  =============
00214 
00215 //  None.
00216 
00217 
00218 }
00219 
00220 */
00221 

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