00001 00002 // 00003 // Class AlephDbManager 00004 // 00005 // The class responsible for the database handling 00006 // It inherits from AlephManager. 00007 // It is a singleton 00008 // 00009 // Author : G. Dissertori , 02.11.98 00010 // 00012 00013 #ifndef ALEPHDBMANAGER_H 00014 #define ALEPHDBMANAGER_H 00015 00016 #include <string> 00017 #include <vector> 00018 #include "AlephManager.h" 00019 00020 class AlphaBanks; 00021 00022 // transaction info 00023 enum AlephTransaction { HALTED , READING , UPDATE }; 00024 00026 class AlephDbManager : public AlephManager 00027 { 00028 public: 00029 00031 static AlephManager* TheAlephDbManager(); 00033 virtual AlephRC initialize(); 00035 virtual AlephRC terminate(); 00037 virtual AlephTransaction transactionType() const; 00039 virtual void setTransactionType(const AlephTransaction& transType); 00041 virtual AlephRC startTransaction(const AlephTransaction& transType); 00043 virtual AlephRC stopTransaction(); 00045 virtual AlephRC commitAndHoldTransaction(); 00047 virtual AlephRC openExistingDb(const vector<string>& aDbName, const string& mode = "TRANSTY"); 00049 virtual AlephRC openNewDb(const string& aDbName); 00051 virtual string dbName() const; 00053 virtual void setDbName(const string& aDbName); 00055 virtual AlephRC StoreEvent(AlphaBanks* event); 00057 virtual AlephRC GetEvent(AlphaBanks*); 00058 protected: 00059 00060 // constructor and destructor 00061 AlephDbManager(); 00062 virtual ~AlephDbManager(); 00063 00064 private: 00065 00066 // the pointer to the single static instance 00067 static AlephManager* _theAlephDbManager; 00068 // the current database name 00069 string _dbName; 00070 // the transaction type 00071 AlephTransaction _theTransactionType; // can be reading,update,halted 00072 }; 00073 00074 00075 00076 00077 00078 #endif