57 DataLogRecord(
int entry, int64_t timestamp, std::span<const uint8_t> data)
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; }
243 int64_t m_timestamp{0};
244 std::span<const uint8_t> m_data;
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;
DataLogReader iterator.
Definition: DataLogReader.h:251
DataLogIterator & operator++()
Definition: DataLogReader.h:351
bool m_valid
Definition: DataLogReader.h:294
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
DataLogRecord m_value
Definition: DataLogReader.h:295
const DataLogReader * m_reader
Definition: DataLogReader.h:292
DataLogIterator(const DataLogReader *reader, size_t pos)
Definition: DataLogReader.h:258
pointer operator->() const
Definition: DataLogReader.h:289
size_t m_pos
Definition: DataLogReader.h:293
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:501
Definition: ntcore_cpp.h:31
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