hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
BaseDB.hpp
Go to the documentation of this file.
1 
15 #ifndef BASE_DB_HPP
16 #define BASE_DB_HPP
17 
18 
22 #include <Poco/SharedPtr.h>
23 
27 #include <iostream>
28 #include <string>
29 #include <list>
30 
31 
35 #include "Errors.hpp"
36 
37 
38 namespace HCE
39 {
40 
41 typedef int STATUS;
42 
47 class BaseDB
48 {
49 public:
51  virtual ~BaseDB() {}
52 public:
53  typedef Poco::SharedPtr<HCE::BaseDB> BaseDBPtr;
54 public:
59  virtual inline void setDatabaseName(const std::string& dbName) { _dbName = dbName; }
64  virtual inline void setDriverUrl(const std::string& dbUrl) { _bootstrapUrls.push_back(dbUrl); }
65 public:
75  virtual void put(const std::string& key, const std::string& value) = 0;
85  virtual std::string get(const std::string& key) = 0;
95  virtual std::vector<std::string> get_all() = 0;
105  virtual void del(const std::string& key) = 0;
111  virtual int getLastError() const = 0;//{ return _error; }
112 public:
113  inline void setWriteUnique(const bool writeUnique) {_writeUnique=writeUnique;}
114  inline void setWritePolicy(const bool writePolicy) {_writePolicy=writePolicy;}
115  inline const bool getWriteUnique() const {return _writeUnique;}
116  inline const bool getWritePolicy() const {return _writePolicy;}
117 protected:
118  std::string _dbName;
119  std::list<std::string> _bootstrapUrls;
123 };
124 
125 
126 }
127 
128 
129 #endif