Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::log::TaggedLine< SIZE > Class Template Reference

One #TAG key=value ... line in a fixed buffer. More...

Detailed Description

template<size_t SIZE = 128>
class sbl::log::TaggedLine< SIZE >

One #TAG key=value ... line in a fixed buffer.

Template Parameters
SIZEBuffer size in bytes, terminator and line ending included

Definition at line 59 of file tagged.hpp.

#include <tagged.hpp>

Public Member Functions

 TaggedLine (const char *tag)
 
void reset (const char *tag)
 
TaggedLine & field (const char *key, float value, uint8_t decimals=3)
 A float field, rounded to decimals places.
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
TaggedLine & field (const char *key, T value)
 
TaggedLine & field (const char *key, const char *value)
 
uint8_t fields () const
 
bool overflowed () const
 
const char * c_str () const
 
template<typename Output >
void write ()
 

Constructor & Destructor Documentation

◆ TaggedLine()

template<size_t SIZE = 128>
sbl::log::TaggedLine< SIZE >::TaggedLine ( const char *  tag)
inlineexplicit

Definition at line 63 of file tagged.hpp.

Member Function Documentation

◆ reset()

template<size_t SIZE = 128>
void sbl::log::TaggedLine< SIZE >::reset ( const char *  tag)
inline

Start over with a new tag and no fields.

Definition at line 66 of file tagged.hpp.

References sbl::log::is_sink_v.

◆ field() [1/3]

template<size_t SIZE = 128>
TaggedLine & sbl::log::TaggedLine< SIZE >::field ( const char *  key,
float  value,
uint8_t  decimals = 3 
)
inline

A float field, rounded to decimals places.

A value that is not finite, or beyond TAGGED_MAX_MAGNITUDE, is written as nan.

Definition at line 82 of file tagged.hpp.

References sbl::log::TaggedLine< SIZE >::field(), sbl::log::is_sink_v, sbl::log::TAGGED_MAX_DECIMALS, and sbl::log::TAGGED_MAX_MAGNITUDE.

Referenced by sbl::log::TaggedLine< SIZE >::field(), and sbl::control::write_scheduler_report().

◆ field() [2/3]

template<size_t SIZE = 128>
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
TaggedLine & sbl::log::TaggedLine< SIZE >::field ( const char *  key,
T  value 
)
inline

An integer field.

Definition at line 107 of file tagged.hpp.

References sbl::log::is_sink_v.

◆ field() [3/3]

template<size_t SIZE = 128>
TaggedLine & sbl::log::TaggedLine< SIZE >::field ( const char *  key,
const char *  value 
)
inline

A string field. The convention allows no spaces in a value.

Definition at line 117 of file tagged.hpp.

References sbl::log::is_sink_v.

◆ fields()

template<size_t SIZE = 128>
uint8_t sbl::log::TaggedLine< SIZE >::fields ( ) const
inline

Number of fields on the line.

Definition at line 123 of file tagged.hpp.

◆ overflowed()

template<size_t SIZE = 128>
bool sbl::log::TaggedLine< SIZE >::overflowed ( ) const
inline

True when a field was left out for lack of room.

Definition at line 126 of file tagged.hpp.

◆ c_str()

template<size_t SIZE = 128>
const char * sbl::log::TaggedLine< SIZE >::c_str ( ) const
inline

The line so far, without its line ending.

Definition at line 129 of file tagged.hpp.

◆ write()

template<size_t SIZE = 128>
template<typename Output >
void sbl::log::TaggedLine< SIZE >::write ( )
inline

Write the line and its line ending to Output (a sink with static void write(const char*)).

Definition at line 133 of file tagged.hpp.


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