NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_io_properties.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_IO_PROPERTIES_H__
11#define __BE_IO_PROPERTIES_H__
12
13#include <map>
14#include <string>
15#include <vector>
16
17#include <be_error_exception.h>
18#include <be_io.h>
19#include <be_memory_autoarray.h>
20
21namespace BiometricEvaluation
22{
23 namespace IO
24 {
30 class Properties {
31 public:
43 const std::map<std::string, std::string>
44 &defaults = {});
45
67 const uint8_t *buffer,
68 const size_t size,
70 const std::map<std::string, std::string>
71 &defaults = {});
72
91 virtual void
93 const std::string &property,
94 const std::string &value);
95
113 virtual void
115 const std::string &property,
116 int64_t value);
117
135 virtual void
137 const std::string &property,
138 double value);
139
157 virtual void
159 const std::string &property,
160 bool value);
161
174 virtual void
176 const std::string &property);
177
188 virtual std::string
190 const std::string &property) const;
191
210 virtual int64_t
212 const std::string &property) const;
213
228 virtual double
230 const std::string &property) const;
231
246 virtual bool
248 const std::string &property)
249 const;
250
258 std::vector<std::string>
260
262 virtual ~Properties();
263
264 protected:
274 const;
275
292 void
294 const Memory::uint8Array &buffer,
295 const std::map<std::string, std::string> &defaults);
296
315 void
317 const uint8_t *const buffer,
318 size_t size,
319 const std::map<std::string, std::string> &defaults);
320
321 private:
326 using PropertiesMap = std::map<std::string, std::string>;
327
329 PropertiesMap _properties;
330
332 IO::Mode _mode;
333
341 void
342 registerDefaults(
343 const PropertiesMap &defaults);
344 };
345 }
346}
347#endif /* __BE_IO_PROPERTIES_H__ */
Maintain key/value pairs of strings, with each property matched to one value.
void initWithBuffer(const Memory::uint8Array &buffer, const std::map< std::string, std::string > &defaults)
Initialize the PropertiesMap with the contents of a properly formatted buffer.
virtual void setPropertyFromDouble(const std::string &property, double value)
Set a property with a double value.
virtual bool getPropertyAsBoolean(const std::string &property) const
void initWithBuffer(const uint8_t *const buffer, size_t size, const std::map< std::string, std::string > &defaults)
Initialize the PropertiesMap with the contents of a properly formatted buffer.
BiometricEvaluation::IO::Mode getMode() const
Obtain the mode of the Properties object.
virtual void setProperty(const std::string &property, const std::string &value)
Set a property with a value.
virtual std::string getProperty(const std::string &property) const
Retrieve a property value as a string object.
virtual void setPropertyFromBoolean(const std::string &property, bool value)
Set a property with a boolean value.
virtual void setPropertyFromInteger(const std::string &property, int64_t value)
Set a property with an integer value.
virtual ~Properties()
Destructor.
virtual double getPropertyAsDouble(const std::string &property) const
Retrieve a property value as a double value.
Properties(IO::Mode mode=IO::Mode::ReadWrite, const std::map< std::string, std::string > &defaults={})
Construct a new Properties object.
virtual int64_t getPropertyAsInteger(const std::string &property) const
Retrieve a property value as an integer value.
std::vector< std::string > getPropertyKeys() const
Retrieve a set of all property keys.
virtual void removeProperty(const std::string &property)
Remove a property.
Properties(const uint8_t *buffer, const size_t size, IO::Mode mode=IO::Mode::ReadWrite, const std::map< std::string, std::string > &defaults={})
Construct a new Properties object from the contents of a buffer.
Mode
Accessibility of object.
Definition: be_io.h:35
@ ReadWrite
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...