NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_io_logsheet.h
Go to the documentation of this file.
1
11#ifndef __BE_IO_LOGSHEET_H__
12#define __BE_IO_LOGSHEET_H__
13
14#include <cstdint>
15#include <memory>
16#include <sstream>
17#include <string>
18
19namespace BiometricEvaluation
20{
21 namespace IO
22 {
57 class Logsheet : public std::ostream
58 {
59 public:
60 enum class Kind {
62 Null,
64 File,
66 Syslog
67 };
68
70 static const char CommentDelimiter = '#';
71
73 static const char EntryDelimiter = 'E';
74
76 static const char DebugDelimiter = 'D';
77
79 static const std::string DescriptionTag;
80
85 static const std::string FILEURLSCHEME;
86
91 static const std::string SYSLOGURLSCHEME;
92
106 const std::string &url);
107
115
126 static bool
127 lineIsEntry(const std::string &line);
128
140 static bool
141 lineIsComment(const std::string &line);
142
154 static bool
155 lineIsDebug(const std::string &line);
156
158 virtual ~Logsheet();
159
173 void
175
184 std::string
186
188 void
190
198 uint32_t
200
215 virtual void
217 const std::string &entry);
218
235 virtual void
237 const std::string &entry);
238
254 virtual void
255 writeDebug(const std::string &entry);
256
270 void
271 setCommit(const bool state);
272
281 bool
282 getCommit() const;
283
297 void
298 setDebugCommit(const bool state);
299
308 bool
310
324 void
325 setCommentCommit(const bool state);
326
335 bool
337
350 virtual void
352
363 void
364 setAutoSync(bool state);
365
372 bool
373 getAutoSync() const;
374
387 static std::string
389 const std::string &entry);
390
391 protected:
396 void
398
406 std::string
408
409 private:
411 std::stringbuf _sbuf{};
412
414 uint32_t _entryNumber{};
415
417 bool _autoSync{};
418
420 bool _commit{};
421
423 bool _debugCommit{};
424
426 bool _commentCommit{};
427 };
428 }
429}
430
431#endif /* __BE_IO_LOGSHEET_H__ */
A class to represent a logging mechanism.
static const char DebugDelimiter
Delimiter for an debug line in the log sheet.
void newEntry()
Start a new entry, causing the existing entry to be closed and written.
bool getCommit() const
Get the current entry commit state.
virtual void write(const std::string &entry)
Write a string as an entry to the backing store.
virtual void sync()
Synchronize any buffered data to the underlying backing store.
virtual ~Logsheet()
Destructor.
static bool lineIsDebug(const std::string &line)
Helper function to determine whether a string is a valid debug log entry.
void setCommit(const bool state)
Enable or disable the commitment of normal entries to the backing log storage.
virtual void writeDebug(const std::string &entry)
Write a string as a debug entry to the backing store.
static std::string trim(const std::string &entry)
Trim delimiters from Logsheet entries.
void setDebugCommit(const bool state)
Enable or disable the commitment of debug entries to the backing log storage.
Logsheet()
Create a Logsheet that has no backing store.
static bool lineIsEntry(const std::string &line)
Helper function to determine whether a string is a valid log entry.
static bool lineIsComment(const std::string &line)
Helper function to determine whether a string is a valid comment log entry.
std::string getCurrentEntryNumberAsString() const
Obtain the current entry 'tag', in 'Edddd' format.
bool getCommentCommit() const
Get the current comment entry commit state.
static const std::string SYSLOGURLSCHEME
The URL scheme to be used for SysLogsheet URL strings.
void setAutoSync(bool state)
Turn on/off auto-sync of the data.
uint32_t getCurrentEntryNumber() const
Obtain the current entry number.
void setCommentCommit(const bool state)
Enable or disable the commitment of comment entries to the backing log storage.
static const char CommentDelimiter
Delimiter for a comment line in the log sheet.
static const std::string DescriptionTag
The tag for the description string.
static const std::string FILEURLSCHEME
The URL scheme to be used for FileLogsheet URL strings.
bool getDebugCommit() const
Get the current debug entry commit state.
static const char EntryDelimiter
Delimiter for an entry line in the log sheet.
void incrementEntryNumber()
Increment the current entry number.
bool getAutoSync() const
Return the current auto-sync state.
static Logsheet::Kind getTypeFromURL(const std::string &url)
Map the URL scheme, taken from a string containing the entire URL, into a Logsheet type.
virtual void writeComment(const std::string &entry)
Write a string as a comment to the backing store.
std::string getCurrentEntry() const
Obtain the contents of the current entry currently under construction.
void resetCurrentEntry()
Reset the current entry buffer to the beginning.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...