58 : m_timestamp{timestamp}, m_data{
data}, m_entry{entry} {}
79 size_t GetSize()
const {
return m_data.size(); }
85 std::span<const uint8_t>
GetRaw()
const {
return m_data; }
244 std::span<const uint8_t> m_data;
259 : m_reader{reader}, m_pos{pos} {}
262 return m_reader == oth.m_reader && m_pos == oth.m_pos;
294 mutable bool m_valid =
false;
309 explicit operator bool()
const {
return IsValid(); }
335 return m_buf ? m_buf->GetBufferIdentifier() :
"Invalid";
345 std::unique_ptr<MemoryBuffer> m_buf;
348 bool GetNextRecord(
size_t* pos)
const;
352 if (!m_reader->GetNextRecord(&m_pos)) {
362 if (m_reader->GetRecord(&pos, &m_value)) {
\rst A contiguous memory buffer with an optional growing ability.
Definition: core.h:862
DataLogReader iterator.
Definition: DataLogReader.h:251
DataLogIterator & operator++()
Definition: DataLogReader.h:351
std::forward_iterator_tag iterator_category
Definition: DataLogReader.h:253
bool operator!=(const DataLogIterator &oth) const
Definition: DataLogReader.h:264
bool operator<(const DataLogIterator &oth) const
Definition: DataLogReader.h:268
const value_type & reference
Definition: DataLogReader.h:256
bool operator>=(const DataLogIterator &oth) const
Definition: DataLogReader.h:275
DataLogIterator operator++(int)
Definition: DataLogReader.h:281
reference operator*() const
Definition: DataLogReader.h:359
DataLogIterator(const DataLogReader *reader, size_t pos)
Definition: DataLogReader.h:258
pointer operator->() const
Definition: DataLogReader.h:289
bool operator==(const DataLogIterator &oth) const
Definition: DataLogReader.h:261
bool operator>(const DataLogIterator &oth) const
Definition: DataLogReader.h:269
bool operator<=(const DataLogIterator &oth) const
Definition: DataLogReader.h:272
Data log reader (reads logs written by the DataLog class).
Definition: DataLogReader.h:299
bool IsValid() const
Returns true if the data log is valid (e.g.
iterator begin() const
Returns iterator to first record.
std::string_view GetExtraHeader() const
Gets the extra header data.
std::string_view GetBufferIdentifier() const
Gets the buffer identifier, typically the filename.
Definition: DataLogReader.h:334
DataLogReader(std::unique_ptr< MemoryBuffer > buffer)
Constructs from a memory buffer.
friend class DataLogIterator
Definition: DataLogReader.h:300
uint16_t GetVersion() const
Gets the data log version.
iterator end() const
Returns end iterator.
Definition: DataLogReader.h:342
A record in the data log.
Definition: DataLogReader.h:54
int GetEntry() const
Gets the entry ID.
Definition: DataLogReader.h:65
bool GetInteger(int64_t *value) const
Decodes a data record as an integer.
bool GetFloat(float *value) const
Decodes a data record as a float.
bool GetBooleanArray(std::vector< int > *arr) const
Decodes a data record as a boolean array.
bool GetStartData(StartRecordData *out) const
Decodes a start control record.
bool GetIntegerArray(std::vector< int64_t > *arr) const
Decodes a data record as an integer array.
std::span< const uint8_t > GetRaw() const
Gets the raw data.
Definition: DataLogReader.h:85
bool GetFinishEntry(int *out) const
Decodes a finish control record.
int64_t GetTimestamp() const
Gets the record timestamp.
Definition: DataLogReader.h:72
bool IsStart() const
Returns true if the record is a start control record.
size_t GetSize() const
Gets the size of the raw data.
Definition: DataLogReader.h:79
bool IsFinish() const
Returns true if the record is a finish control record.
bool GetStringArray(std::vector< std::string_view > *arr) const
Decodes a data record as a string array.
bool GetBoolean(bool *value) const
Decodes a data record as a boolean.
bool IsSetMetadata() const
Returns true if the record is a set metadata control record.
bool GetString(std::string_view *value) const
Decodes a data record as a string.
bool GetDoubleArray(std::vector< double > *arr) const
Decodes a data record as a double array.
bool IsControl() const
Returns true if the record is a control record.
Definition: DataLogReader.h:92
bool GetSetMetadataData(MetadataRecordData *out) const
Decodes a set metadata control record.
bool GetDouble(double *value) const
Decodes a data record as a double.
DataLogRecord(int entry, int64_t timestamp, std::span< const uint8_t > data)
Definition: DataLogReader.h:57
bool GetFloatArray(std::vector< float > *arr) const
Decodes a data record as a float array.
basic_string_view< char > string_view
Definition: core.h:520
::uint16_t uint16_t
Definition: Meta.h:54
::int64_t int64_t
Definition: Meta.h:59
Definition: ntcore_cpp.h:30
Definition: format.h:1544
Data contained in a start control record as created by DataLog::Start() when writing the log.
Definition: DataLogReader.h:23
std::string_view type
Type of the stored data for this entry, as a string, e.g.
Definition: DataLogReader.h:31
int entry
Entry ID; this will be used for this entry in future records.
Definition: DataLogReader.h:25
std::string_view name
Entry name.
Definition: DataLogReader.h:28
std::string_view metadata
Initial metadata.
Definition: DataLogReader.h:34