blob: 7f22509b56e7e08f79ab3b1971bcf32b0e4385a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "caffe/util/db.hpp"
#include "caffe/util/db_leveldb.hpp"
#include "caffe/util/db_lmdb.hpp"
#include <string>
namespace caffe { namespace db {
DB* GetDB(DataParameter::DB backend) {
switch (backend) {
#ifdef USE_LEVELDB
case DataParameter_DB_LEVELDB:
return new LevelDB();
#endif // USE_LEVELDB
#ifdef USE_LMDB
case DataParameter_DB_LMDB:
return new LMDB();
#endif // USE_LMDB
default:
LOG(FATAL) << "Unknown database backend";
return NULL;
}
}
DB* GetDB(const string& backend) {
#ifdef USE_LEVELDB
if (backend == "leveldb") {
return new LevelDB();
}
#endif // USE_LEVELDB
#ifdef USE_LMDB
if (backend == "lmdb") {
return new LMDB();
}
#endif // USE_LMDB
LOG(FATAL) << "Unknown database backend";
return NULL;
}
} // namespace db
} // namespace caffe
|