db 数据库读取程序在 util 中, 头文件可以看出, 先定义个一个基类,然后派生出两个数据方式。 LevelDB 和 LMDB .
这两种数据库的操作方式几乎相同,所以 基类方法都定义为 虚函数, 有各个的派生类来实现
这些方法 主要在layer文件的 data层调用
官网API 介绍 http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1db_1_1LMDBCursor.html
caffe::db::Cursor Class Reference
abstract
Inheritance diagram for caffe::db::Cursor:
![](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1db_1_1Cursor.png)
Public Member Functions | |
virtual void | SeekToFirst ()=0 |
virtual void | Next ()=0 |
virtual string | key ()=0 |
virtual string | value ()=0 |
virtual bool | valid ()=0 |
DISABLE_COPY_AND_ASSIGN (Cursor) | |
The documentation for this class was generated from the following file:
- include/caffe/util/db.hpp
caffe::db::LevelDBCursor Class Reference
Inheritance diagram for caffe::db::LevelDBCursor:
![](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1db_1_1LevelDBCursor.png)
Public Member Functions | |
LevelDBCursor (leveldb::Iterator *iter) | |
virtual void | SeekToFirst () |
virtual void | Next () |
virtual string | key () |
virtual string | value () |
virtual bool | valid () |
![]() |
The documentation for this class was generated from the following file:
- include/caffe/util/db_leveldb.hpp
caffe::db::LMDBCursor Class Reference
Inheritance diagram for caffe::db::LMDBCursor:
![](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1db_1_1LMDBCursor.png)
Public Member Functions | |
LMDBCursor (MDB_txn *mdb_txn, MDB_cursor *mdb_cursor) | |
virtual void | SeekToFirst () |
virtual void | Next () |
virtual string | key () |
virtual string | value () |
virtual bool | valid () |
![]() |
The documentation for this class was generated from the following file:
- include/caffe/util/db_lmdb.hpp