• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/examples_cxx/getting_started/
1// File: MyDb.hpp
2
3#ifndef MYDB_H
4#define MYDB_H
5
6#include <string>
7#include <db_cxx.h>
8
9class MyDb
10{
11public:
12    // Constructor requires a path to the database,
13    // and a database name.
14    MyDb(std::string &path, std::string &dbName,
15         bool isSecondary = false);
16
17    // Our destructor just calls our private close method.
18    ~MyDb() { close(); }
19
20    inline Db &getDb() {return db_;}
21
22private:
23    Db db_;
24    std::string dbFileName_;
25    u_int32_t cFlags_;
26
27    // Make sure the default constructor is private
28    // We don't want it used.
29    MyDb() : db_(NULL, 0) {}
30
31    // We put our database close activity here.
32    // This is called from our destructor. In
33    // a more complicated example, we might want
34    // to make this method public, but a private
35    // method is more appropriate for this example.
36    void close();
37};
38#endif
39