Caffe
db.hpp
1 #ifndef CAFFE_UTIL_DB_HPP
2 #define CAFFE_UTIL_DB_HPP
3 
4 #include <string>
5 
6 #include "caffe/common.hpp"
7 #include "caffe/proto/caffe.pb.h"
8 
9 namespace caffe { namespace db {
10 
11 enum Mode { READ, WRITE, NEW };
12 
13 class Cursor {
14  public:
15  Cursor() { }
16  virtual ~Cursor() { }
17  virtual void SeekToFirst() = 0;
18  virtual void Next() = 0;
19  virtual string key() = 0;
20  virtual string value() = 0;
21  virtual bool valid() = 0;
22 
23  DISABLE_COPY_AND_ASSIGN(Cursor);
24 };
25 
26 class Transaction {
27  public:
28  Transaction() { }
29  virtual ~Transaction() { }
30  virtual void Put(const string& key, const string& value) = 0;
31  virtual void Commit() = 0;
32 
33  DISABLE_COPY_AND_ASSIGN(Transaction);
34 };
35 
36 class DB {
37  public:
38  DB() { }
39  virtual ~DB() { }
40  virtual void Open(const string& source, Mode mode) = 0;
41  virtual void Close() = 0;
42  virtual Cursor* NewCursor() = 0;
43  virtual Transaction* NewTransaction() = 0;
44 
45  DISABLE_COPY_AND_ASSIGN(DB);
46 };
47 
48 DB* GetDB(DataParameter::DB backend);
49 DB* GetDB(const string& backend);
50 
51 } // namespace db
52 } // namespace caffe
53 
54 #endif // CAFFE_UTIL_DB_HPP
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
Definition: db.hpp:26
Definition: db.hpp:36
Definition: db.hpp:13