00001 #ifndef DBIRPT_H 00002 #define DBIRPT_H 00003 00004 #include "DatabaseInterface/DbiResultPtr.h" 00005 #include "DybDbi/DbiCtx.h" 00006 #include <string> 00007 using namespace std ; 00008 00009 /* 00010 Wrapper for DbiResultPtr<T> providing 00011 00012 * usage from python (the bare m_rpt cannot be dictionary-fied) 00013 * controlled record of the context used 00014 * access by default context 00015 * access by string context representation 00016 00017 */ 00018 00019 class DbiValidityRec ; 00020 class DbiTableProxy ; 00021 class DbiResultKey ; 00022 00023 template <class T> class DbiRpt 00024 { 00025 public: 00026 DbiRpt(); // default context copyied into Rpt 00027 DbiRpt(const DbiCtx& ctx); // context copyied into Rpt 00028 DbiRpt(const char* sctx); // context copyied into Rpt 00029 00030 DbiRpt(const DbiRpt<T>& other); // copy ctor 00031 DbiRpt<T>* Clone(); 00032 00033 00034 const char* GetName(); 00035 const DbiCtx& GetCtx(); 00036 00037 void Delete(); 00038 virtual ~DbiRpt(); 00039 00040 // propagate state testing member functions from the contained DbiResultPtr 00041 // ( no longer "const" member funcs, as triggers MakeResultPtr after ctx changes ) 00042 // 00043 const DbiResultKey* GetKey() ; 00044 UInt_t GetNumRows(); 00045 const DbiResult* GetResult() ; 00046 Int_t GetResultID() ; 00047 const T* GetRow( UInt_t row ); 00048 const T* GetRowByIndex( UInt_t index ); 00049 const DbiValidityRec* GetValidityRec(const T* row = NULL) ; 00050 DbiTableProxy& TableProxy(); 00051 Bool_t ResultsFromDb(); 00052 00053 00054 // state changing member funcs ... 00055 UInt_t NextQuery(Bool_t forwards = kTRUE); 00056 00057 00058 static DbiTableProxy& GetTableProxy(); 00059 static DbiTableProxy& GetTableProxy(const string& tableName); 00060 00061 00062 private: 00063 DbiResultPtr<T>* GetResultPtr(); // useless from python as un-dictionaryable 00064 void MakeResultPtr(); 00065 00066 string m_name ; 00067 DbiCtx m_ctx ; 00068 DbiResultPtr<T>* m_rpt ; 00069 00070 }; 00071 00072 #endif