00001 // $Id: DbiDemoData1.h,v 1.10 2003/05/01 11:50:28 west Exp $ 00002 00003 #ifndef DBIDEMODATA1_H 00004 #define DBIDEMODATA1_H 00005 00007 // DbiDemoData1 // 00008 // // 00009 // Package: Dbi (Database Interface). // 00010 // // 00011 // Concept: A concrete data type corresponding to a single row in a // 00012 // database table of non-aggregated data. // 00013 // // 00014 // N. West 02/2001 // 00016 00017 #include <string> 00018 using namespace std; 00019 00020 #include "Rtypes.h" 00021 #include "DatabaseInterface/DbiTableRow.h" 00022 00023 class DbiValidityRec; 00024 00025 class DbiDemoData1 : public DbiTableRow 00026 { 00027 00028 //using TObject::Compare; // So won't be hidden 00029 00030 public: 00031 // Constructors and destructors. 00032 DbiDemoData1() { } 00033 DbiDemoData1(const DbiDemoData1& from) 00034 : DbiTableRow(from) { *this = from; } 00035 DbiDemoData1(UInt_t s, Float_t p, Float_t g1, Float_t g2) : 00036 fSubSystem(s),fPedestal(p),fGain1(g1),fGain2(g2) { } 00037 virtual ~DbiDemoData1(){ }; 00038 00039 00040 // State testing member functions 00041 Bool_t CanL2Cache() const { return kTRUE; } 00042 Bool_t Compare(const DbiDemoData1& that ) const { 00043 return fSubSystem == that.fSubSystem 00044 && fPedestal == that.fPedestal 00045 && fGain1 == that.fGain1 00046 && fGain2 == that.fGain2; } 00047 00048 UInt_t GetIndex(UInt_t /* defIndex */) const { return fSubSystem + 3000000000U; } 00049 Int_t GetSubSystem() const { return fSubSystem; } 00050 Float_t GetPedestal() const { return fPedestal; } 00051 Float_t GetGain1() const { return fGain1; } 00052 Float_t GetGain2() const { return fGain2; } 00053 00054 virtual DbiTableRow* CreateTableRow() const { 00055 return new DbiDemoData1; } 00056 00057 // I/O member functions 00058 virtual void Fill(DbiResultSet& rs, 00059 const DbiValidityRec* vrec); 00060 virtual void Store(DbiOutRowStream& ors, 00061 const DbiValidityRec* vrec) const; 00062 00063 // Static functions 00064 00065 static string GetTableDescr(const char* alternateName = 0); 00066 00067 00068 private: 00069 00070 // Data members 00071 00072 Int_t fSubSystem; 00073 Float_t fPedestal; 00074 Float_t fGain1; 00075 Float_t fGain2; 00076 00077 // Removed: ClassDef(DbiDemoData1,0) // Example of non-aggregated datadata type. 00078 00079 }; 00080 00081 00082 #endif // DBIDEMODATA1_H