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