ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PdbApplication.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PdbApplication.h
1 #ifndef PDBCAL_BASE_PDBAPPLICATION_H
2 #define PDBCAL_BASE_PDBAPPLICATION_H
3 
4 #include "Pdb.h"
5 
6 #include <memory> // for unique_ptr
7 #include <string>
8 
9 class PdbCalBank;
10 
12 {
13 
14 protected:
16 
17 public:
18  static PdbApplication *instance();
19  virtual ~PdbApplication() {}
20 
21 
22  virtual PdbStatus startUpdate() = 0;
23  virtual PdbStatus startRead() = 0;
24  virtual PdbStatus commit() = 0;
25  virtual PdbStatus abort() = 0;
26  virtual PdbStatus isActive() = 0;
27  virtual PdbStatus commit(PdbCalBank *) = 0;
28  virtual PdbStatus commit(PdbCalBank *,int,long,long,long) = 0;
29  //
30  // Should return the file (database) size in bytes.
31  //
32 
33  virtual int setDBName(const std::string &name) = 0;
34  virtual int DisconnectDB() = 0;
35 
36 protected:
37  // Wrap the singleton object in an unique_ptr so it gets cleaned up.
38  // Even though unique_ptr is often a horrible choice, here it should be ok
39  // since __instance will never be copied. If this wouldn't be visible for
40  // CINT a good choice would have been boost::scoped_ptr, or in C++11
41  // std::unique_ptr.
42  friend class std::unique_ptr<PdbApplication>;
43  static std::unique_ptr<PdbApplication> __instance;
44 };
45 
46 #endif /* PDBCAL_BASE_PDBAPPLICATION_H */