WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
wpi::log::RawLogEntry Class Reference

Log arbitrary byte data. More...

#include <wpi/DataLog.h>

Inheritance diagram for wpi::log::RawLogEntry:
wpi::log::DataLogValueEntryImpl< std::vector< uint8_t > > wpi::log::DataLogEntry

Public Member Functions

 RawLogEntry ()=default
 
 RawLogEntry (DataLog &log, std::string_view name, int64_t timestamp=0)
 
 RawLogEntry (DataLog &log, std::string_view name, std::string_view metadata, int64_t timestamp=0)
 
 RawLogEntry (DataLog &log, std::string_view name, std::string_view metadata, std::string_view type, int64_t timestamp=0)
 
void Append (std::span< const uint8_t > data, int64_t timestamp=0)
 Appends a record to the log.
 
void Update (std::span< const uint8_t > data, int64_t timestamp=0)
 Updates the last value and appends a record to the log if it has changed.
 
- Public Member Functions inherited from wpi::log::DataLogValueEntryImpl< std::vector< uint8_t > >
 DataLogValueEntryImpl (DataLogValueEntryImpl &&rhs)
 
DataLogValueEntryImploperator= (DataLogValueEntryImpl &&rhs)
 
bool HasLastValue () const
 Gets whether there is a last value.
 
std::optional< std::vector< uint8_t > > GetLastValue () const
 Gets the last value.
 
- Public Member Functions inherited from wpi::log::DataLogEntry
 DataLogEntry (const DataLogEntry &)=delete
 
DataLogEntryoperator= (const DataLogEntry &)=delete
 
 DataLogEntry (DataLogEntry &&rhs)
 
DataLogEntryoperator= (DataLogEntry &&rhs)
 
 operator bool () const
 
void SetMetadata (std::string_view metadata, int64_t timestamp=0)
 Updates the metadata for the entry.
 
void Finish (int64_t timestamp=0)
 Finishes the entry.
 

Static Public Attributes

static constexpr std::string_view kDataType = "raw"
 

Additional Inherited Members

- Protected Member Functions inherited from wpi::log::DataLogValueEntryImpl< std::vector< uint8_t > >
 DataLogValueEntryImpl ()=default
 
 DataLogValueEntryImpl (DataLog &log, std::string_view name, std::string_view type, std::string_view metadata={}, int64_t timestamp=0)
 
- Protected Member Functions inherited from wpi::log::DataLogEntry
 DataLogEntry ()=default
 
 DataLogEntry (DataLog &log, std::string_view name, std::string_view type, std::string_view metadata={}, int64_t timestamp=0)
 
- Protected Attributes inherited from wpi::log::DataLogValueEntryImpl< std::vector< uint8_t > >
wpi::mutex m_mutex
 
std::optional< std::vector< uint8_t > > m_lastValue
 
- Protected Attributes inherited from wpi::log::DataLogEntry
DataLogm_log = nullptr
 
int m_entry = 0
 

Detailed Description

Log arbitrary byte data.

Constructor & Destructor Documentation

◆ RawLogEntry() [1/4]

wpi::log::RawLogEntry::RawLogEntry ( )
default

◆ RawLogEntry() [2/4]

wpi::log::RawLogEntry::RawLogEntry ( DataLog & log,
std::string_view name,
int64_t timestamp = 0 )
inline

◆ RawLogEntry() [3/4]

wpi::log::RawLogEntry::RawLogEntry ( DataLog & log,
std::string_view name,
std::string_view metadata,
int64_t timestamp = 0 )
inline

◆ RawLogEntry() [4/4]

wpi::log::RawLogEntry::RawLogEntry ( DataLog & log,
std::string_view name,
std::string_view metadata,
std::string_view type,
int64_t timestamp = 0 )
inline

Member Function Documentation

◆ Append()

void wpi::log::RawLogEntry::Append ( std::span< const uint8_t > data,
int64_t timestamp = 0 )
inline

Appends a record to the log.

Parameters
dataData to record
timestampTime stamp (may be 0 to indicate now)

◆ Update()

void wpi::log::RawLogEntry::Update ( std::span< const uint8_t > data,
int64_t timestamp = 0 )

Updates the last value and appends a record to the log if it has changed.

Note
The last value is local to this class instance; using Update() with two instances pointing to the same underlying log entry name will likely result in unexpected results.
Parameters
dataData to record
timestampTime stamp (may be 0 to indicate now)

Member Data Documentation

◆ kDataType

std::string_view wpi::log::RawLogEntry::kDataType = "raw"
staticconstexpr

The documentation for this class was generated from the following file: