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

DbiDemoData1.cxx

Go to the documentation of this file.
00001 
00002 // $Id: DbiDemoData1.cxx,v 1.9 2004/10/14 12:47:44 west Exp $
00003 //
00004 // DbiDemoData1
00005 //
00006 // Package: Dbi (Database Interface).
00007 
00008 // Begin_Html<img src="../../pedestrians.gif" align=center>
00009 // <a href="../source_warning.html">Warning for beginners</a>.<br>
00010 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and
00011 // <a href="../index.html">The MINOS Class User Guide</a>End_Html
00012 //
00013 // N. West 02/2001
00014 //
00015 // Concept: A concrete data type corresponding to a single row in a
00016 //          database table of non-aggregated data.
00017 //   
00018 // Purpose: Example type for test and demonstration purposes.
00019 //
00021 
00022 #include "DatabaseInterface/test/DbiDemoData1.h"
00023 #include "MessageService/MsgService.h"
00024 #include "DatabaseInterface/DbiOutRowStream.h"
00025 #include "DatabaseInterface/DbiResultSet.h"
00026 #include "DatabaseInterface/DbiValidityRec.h"
00027 
00028 ClassImp(DbiDemoData1)
00029 
00030 
00031 //   Definition of static data members
00032 //   *********************************
00033 
00034 CVSID("$Id: DbiDemoData1.cxx,v 1.9 2004/10/14 12:47:44 west Exp $\n  \
00035       CVSID_DBIRESULTPTR ");
00036 
00037 
00038 //  Instantiate associated Result Pointer and writer classes.
00039 //  ********************************************************
00040 
00041 #include "DatabaseInterface/DbiResultPtr.tpl"
00042 template class  DbiResultPtr<DbiDemoData1>;
00043 
00044 #include "DatabaseInterface/DbiWriter.tpl"
00045 template class  DbiWriter<DbiDemoData1>;
00046 
00047 // Definition of member functions (alphabetical order)
00048 // ***************************************************
00049 
00050 
00051 //.....................................................................
00052 
00053 void DbiDemoData1::Fill(DbiResultSet& rs,
00054                         const DbiValidityRec* /* vrec */) {
00055 //
00056 //
00057 //  Purpose:  Fill object from Result Set
00058 //
00059 //  Arguments: 
00060 //    rs           in    Result Set used to fill object
00061 //    vrec         in    Associated validity record (or 0 if filling
00062 //                                                    DbiValidityRec)
00063 //  Return:    
00064 //
00065 //  Contact:   N. West
00066 //
00067 //  Specification:-
00068 //  =============
00069 //
00070 //  o Fill object from current row of Result Set.
00071 
00072 //  Program Notes:-
00073 //  =============
00074 
00075 //  This method demonstrates both the "dumb" fill method (just
00076 //  load the data as it comes) and the smart method (check column
00077 //  name and load according to column order). 
00078 
00079   if (    rs.TableName() != "DEMOASCIIDATA" 
00080        && rs.TableName() != "DemoASCIIData" ) {
00081     
00082 // Dumb method.
00083   rs >> fSubSystem >> fPedestal >> fGain1 >> fGain2;
00084 
00085   }
00086   
00087 // Smart method
00088   else {
00089     Int_t numCol = rs.NumCols();
00090     //  The first column (SeqNo) has already been processed.
00091     for (Int_t curCol = 2; curCol <= numCol; ++curCol) {
00092       string colName = rs.CurColName();
00093       if (      colName == "SUBSYSTEM" ) rs >> fSubSystem;
00094       else if ( colName == "PEDESTAL" )  rs >> fPedestal;
00095       else if ( colName == "GAIN1" )     rs >> fGain1;
00096       else if ( colName == "GAIN2" )     rs >> fGain2;
00097       else {
00098         MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00099                                << "(" << colName << ")"
00100                               << "; not part of DbiDemoData1" << endl;
00101         rs.IncrementCurCol();
00102       }
00103     }
00104     
00105   }
00106 }
00107 //.....................................................................
00108 
00109 void DbiDemoData1::Store(DbiOutRowStream& ors,
00110                          const DbiValidityRec* /* vrec */) const {
00111 //
00112 //
00113 //  Purpose:  Stream object to output row stream
00114 //
00115 //  Arguments: 
00116 //    ors          in     Output row stream.
00117 //    vrec         in    Associated validity record (or 0 if filling
00118 //                                                    DbiValidityRec)
00119 //
00120 //  Return:    
00121 //
00122 //  Contact:   N. West
00123 //
00124 //  Specification:-
00125 //  =============
00126 //
00127 //  o  Stream object to output row stream.
00128 
00129 //  Program Notes:-
00130 //  =============
00131 
00132 //  None.
00133 
00134 
00135   ors << fSubSystem << fPedestal << fGain1 << fGain2;
00136    
00137 }
00138 
00139 /*    Template for New Member Function
00140 
00141 //.....................................................................
00142 
00143 DbiDemoData1:: {
00144 //
00145 //
00146 //  Purpose:  
00147 //
00148 //  Arguments: 
00149 //    xxxxxxxxx    in    yyyyyy
00150 //
00151 //  Return:    
00152 //
00153 //  Contact:   N. West
00154 //
00155 //  Specification:-
00156 //  =============
00157 //
00158 //  o 
00159 
00160 //  Program Notes:-
00161 //  =============
00162 
00163 //  None.
00164 
00165 
00166 }
00167 
00168 */
00169 

Generated on Mon Feb 15 11:06:34 2010 for loon by  doxygen 1.3.9.1