-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbe_io_listrecstore.h
147 lines (126 loc) · 3.86 KB
/
be_io_listrecstore.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/**
* This software was developed at the National Institute of Standards and
* Technology (NIST) by employees of the Federal Government in the course
* of their official duties. Pursuant to title 17 Section 105 of the
* United States Code, this software is not subject to copyright protection
* and is in the public domain. NIST assumes no responsibility whatsoever for
* its use by other parties, and makes no guarantees, expressed or implied,
* about its quality, reliability, or any other characteristic.
*/
#ifndef __BE_IO_LISTRECSTORE_H__
#define __BE_IO_LISTRECSTORE_H__
#include <memory.h>
#include <be_io_recordstore.h>
namespace BiometricEvaluation
{
namespace IO
{
/**
* @brief
* IO::RecordStore that reads a list of keys from a text file,
* and retrieves the data from another IO::RecordStore.
* @details
* ListRecordStores must be hand-crafted by first setting the
* 'Source Record Store', 'Type', and 'Count' properties in the
* .rscontrol.prop file. 'Source Record Store' is the complete
* path of the RecordStore containing the actual data records.
* Type must be 'List'. Count should match the number of
* entries in the file created next. Other properties are as
* in a "normal" RecordStore; see example below.
*
* Second, create a file called 'KeyList.txt' in the
* RecordStore directory containing a list of keys, one
* per line.
*
* ListRecordStores can also be created and modified with
* versions of rstool(1) from 2013 or later.
*
* Example .rscontrol.prop file:
* Count = 10
* Description = Search records for SDK TESTSDK
* Name = TestLRS
* Type = List
* Source Record Store = /Users/wsalamon/sandbox/SD29.rs
*
* @note
* List RecordStores must be opened read-only.
*
* @important
* The list of keys is only consulted when iterating the
* ListRecordStore. Read methods invoked manually will succeed
* for any key present in the backing RecordStore, regardless of
* the key's presence in the explicit list of keys.
*/
class ListRecordStore : public RecordStore {
public:
/** Constructor, always opening read-only */
ListRecordStore(
const std::string &pathname);
/** Destructor */
~ListRecordStore() = default;
/*
* Implementation of the RecordStore interface.
*/
/*
* We need the base class insert() and replace() as well
* otherwise, they are hidden by the declarations below.
*/
using RecordStore::insert;
using RecordStore::replace;
void
insert(
const std::string &key,
const void *const data,
const uint64_t size)
override;
void
remove(
const std::string &key)
override;
Memory::uint8Array
read(
const std::string &key) const override;
void
replace(
const std::string &key,
const void *const data,
const uint64_t size) override final;
uint64_t
length(
const std::string &key) const override;
void
flush(
const std::string &key) const override;
void
sync() const override;
RecordStore::Record
sequence(
int cursor = BE_RECSTORE_SEQ_NEXT)
override;
std::string
sequenceKey(
int cursor = BE_RECSTORE_SEQ_NEXT)
override;
void
setCursorAtKey(
const std::string &key)
override;
void
move(
const std::string &pathname)
override;
uint64_t
getSpaceUsed() const
override;
unsigned int getCount() const override;
std::string getPathname() const override;
std::string getDescription() const override;
void changeDescription(
const std::string &description) override;
private:
class Impl;
std::unique_ptr<ListRecordStore::Impl> pimpl;
};
}
}
#endif /* __BE_IO_LISTRECSTORE_H__ */