NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_io_dbrecstore.h
Go to the documentation of this file.
1/******************************************************************************
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 ******************************************************************************/
10#ifndef __BE_DBRECSTORE_H__
11#define __BE_DBRECSTORE_H__
12
13#include <be_io_recordstore.h>
14
15/*
16 * This file contains the class declaration for an implementation of a
17 * RecordStore using a on-disk database.
18 */
19namespace BiometricEvaluation {
20
21 namespace IO {
22
28 class DBRecordStore : public RecordStore {
29 public:
30
46 const std::string &pathname,
47 const std::string &description);
48
64 const std::string &pathname,
66
67 /*
68 * Destructor.
69 */
71
72 /*
73 * Implementation of the RecordStore interface.
74 */
75
76 /*
77 * We need the base class insert() and replace() as well
78 * otherwise, they are hidden by the declarations below.
79 */
82
85 const std::string &key) const override;
86
87 void insert(
88 const std::string &key,
89 const void *const data,
90 const uint64_t size)
91 override;
92
93 void remove(
94 const std::string &key)
95 override;
96
97 uint64_t length(
98 const std::string &key) const override;
99
100 void flush(
101 const std::string &key) const override;
102
104 int cursor = BE_RECSTORE_SEQ_NEXT)
105 override;
106
107 std::string
109 int cursor = BE_RECSTORE_SEQ_NEXT)
110 override;
111
113 const std::string &key)
114 override;
115
116 void move(
117 const std::string &pathname)
118 override;
119
120 uint64_t getSpaceUsed() const override;
121 void sync() const override;
122 unsigned int getCount() const override;
123 std::string getPathname() const override;
124 std::string getDescription() const override;
126 const std::string &description) override;
127
128 /* Prevent copying of DBRecordStore objects */
129 DBRecordStore(const DBRecordStore&) = delete;
131
132 private:
133 class Impl;
134 std::unique_ptr<DBRecordStore::Impl> pimpl;
135 };
136 }
137}
138#endif /* __BE_DBRECSTORE_H__ */
A class that implements IO::RecordStore using a Berkeley DB database as the underlying record storage...
std::string sequenceKey(int cursor=BE_RECSTORE_SEQ_NEXT) override
Sequence through a RecordStore, returning the key.
void remove(const std::string &key) override
Remove a record from the store.
void move(const std::string &pathname) override
Move the RecordStore.
std::string getDescription() const override
Obtain a textual description of the RecordStore.
unsigned int getCount() const override
Obtain the number of items in the RecordStore.
uint64_t getSpaceUsed() const override
Obtain real storage utilization.
RecordStore::Record sequence(int cursor=BE_RECSTORE_SEQ_NEXT) override
Sequence through a RecordStore, returning the key/data pairs.
uint64_t length(const std::string &key) const override
Return the length of a record.
void changeDescription(const std::string &description) override
Change the description of the RecordStore.
DBRecordStore(const DBRecordStore &)=delete
Memory::uint8Array read(const std::string &key) const override
Read a complete record from a store.
void setCursorAtKey(const std::string &key) override
Set the sequence cursor to an arbitrary position within the RecordStore, starting at key.
DBRecordStore & operator=(const DBRecordStore &)=delete
void sync() const override
Synchronize the entire record store to persistent storage.
void flush(const std::string &key) const override
Commit the record's data to storage.
DBRecordStore(const std::string &pathname, const std::string &description)
Create a new DBRecordStore, read/write mode.
std::string getPathname() const override
Return the path name of the RecordStore.
void insert(const std::string &key, const void *const data, const uint64_t size) override
Insert a record into the store.
DBRecordStore(const std::string &pathname, IO::Mode mode=IO::Mode::ReadOnly)
Open an existing DBRecordStore.
A class to represent a data storage mechanism.
virtual void insert(const std::string &key, const Memory::uint8Array &data)
Insert a record into the store.
static const int BE_RECSTORE_SEQ_NEXT
Tell sequence to sequence from current position.
virtual void replace(const std::string &key, const Memory::uint8Array &data)
Replace a complete record in a RecordStore.
Mode
Accessibility of object.
Definition: be_io.h:35
@ ReadOnly
Constant indicating the state of an object that manages some underlying file is accessible for readin...
This software was developed at the National Institute of Standards and Technology (NIST) by employees...