WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
wpi::log::StructLogEntry< T, I > Class Template Reference

Log raw struct serializable objects. More...

#include <wpi/DataLog.h>

Inheritance diagram for wpi::log::StructLogEntry< T, I >:
wpi::log::DataLogEntry

Public Member Functions

 StructLogEntry ()=default
 
 StructLogEntry (DataLog &log, std::string_view name, I... info, int64_t timestamp=0)
 
 StructLogEntry (DataLog &log, std::string_view name, std::string_view metadata, I... info, int64_t timestamp=0)
 
 StructLogEntry (StructLogEntry &&rhs)
 
StructLogEntryoperator= (StructLogEntry &&rhs)
 
void Append (const T &data, int64_t timestamp=0)
 Appends a record to the log.
 
void Update (const T &data, int64_t timestamp=0)
 Updates the last value and appends a record to the log if it has changed.
 
bool HasLastValue () const
 Gets whether there is a last value.
 
std::optional< 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.
 

Additional Inherited Members

- 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::DataLogEntry
DataLogm_log = nullptr
 
int m_entry = 0
 

Detailed Description

template<typename T, typename... I>
requires StructSerializable<T, I...>
class wpi::log::StructLogEntry< T, I >

Log raw struct serializable objects.

Constructor & Destructor Documentation

◆ StructLogEntry() [1/4]

template<typename T , typename... I>
wpi::log::StructLogEntry< T, I >::StructLogEntry ( )
default

◆ StructLogEntry() [2/4]

template<typename T , typename... I>
wpi::log::StructLogEntry< T, I >::StructLogEntry ( DataLog & log,
std::string_view name,
I... info,
int64_t timestamp = 0 )
inline

◆ StructLogEntry() [3/4]

template<typename T , typename... I>
wpi::log::StructLogEntry< T, I >::StructLogEntry ( DataLog & log,
std::string_view name,
std::string_view metadata,
I... info,
int64_t timestamp = 0 )
inline

◆ StructLogEntry() [4/4]

template<typename T , typename... I>
wpi::log::StructLogEntry< T, I >::StructLogEntry ( StructLogEntry< T, I > && rhs)
inline

Member Function Documentation

◆ Append()

template<typename T , typename... I>
void wpi::log::StructLogEntry< T, I >::Append ( const 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)

◆ GetLastValue()

template<typename T , typename... I>
std::optional< T > wpi::log::StructLogEntry< T, I >::GetLastValue ( ) const
inline

Gets the last value.

Note
The last value is local to this class instance and updated only with Update(), not Append().
Returns
Last value (empty if no last value)

◆ HasLastValue()

template<typename T , typename... I>
bool wpi::log::StructLogEntry< T, I >::HasLastValue ( ) const
inline

Gets whether there is a last value.

Note
The last value is local to this class instance and updated only with Update(), not Append().
Returns
True if last value exists, false otherwise.

◆ operator=()

template<typename T , typename... I>
StructLogEntry & wpi::log::StructLogEntry< T, I >::operator= ( StructLogEntry< T, I > && rhs)
inline

◆ Update()

template<typename T , typename... I>
void wpi::log::StructLogEntry< T, I >::Update ( const T & data,
int64_t timestamp = 0 )
inline

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)

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