DaZeus  2.0
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
database.h
Go to the documentation of this file.
1 
6 #ifndef DATABASE_H
7 #define DATABASE_H
8 
9 #include <vector>
10 #include <string>
11 #include <stdint.h>
12 
13 namespace dazeus {
14 
16  DatabaseConfig(std::string t = std::string(), std::string h = std::string("127.0.0.1"),
17  uint16_t p = 27017, std::string user = std::string(), std::string pass =
18  std::string(), std::string db = std::string("dazeus"), std::string opt =
19  std::string()) : type(t), hostname(h), port(p), username(user),
20  password(pass), database(db), options(opt) {}
26  s.password; database = s.database; options = s.options; return *this; }
27 
28  std::string type;
29  std::string hostname;
30  uint16_t port;
31  std::string username;
32  std::string password;
33  std::string database;
34  std::string options;
35 };
36 
51 class Database
52 {
53  public:
54  Database( const std::string &hostname, uint16_t port,
55  const std::string &database = std::string("dazeus"),
56  const std::string &username = std::string(),
57  const std::string &password = std::string() );
58  ~Database();
59 
60  bool open();
61  std::string lastError() const;
62 
63  std::string property( const std::string &variable,
64  const std::string &networkScope = std::string(),
65  const std::string &receiverScope = std::string(),
66  const std::string &senderScope = std::string() );
67  void setProperty( const std::string &variable,
68  const std::string &value,
69  const std::string &networkScope = std::string(),
70  const std::string &receiverScope = std::string(),
71  const std::string &senderScope = std::string());
72  std::vector<std::string> propertyKeys( const std::string &ns,
73  const std::string &networkScope = std::string(),
74  const std::string &receiverScope = std::string(),
75  const std::string &senderScope = std::string() );
76 
77  private:
78  // explicitly disable copy constructor
79  Database(const Database&);
80  void operator=(const Database&);
81 
82  void *m_;
83  std::string lastError_;
84  std::string hostName_;
85  std::string databaseName_;
86  uint16_t port_;
87  std::string username_;
88  std::string password_;
89 };
90 
91 }
92 
93 #endif