Pigweed
 
Loading...
Searching...
No Matches
pw::tokenizer::EncodedMessage< kMaxSizeBytes > Class Template Reference

#include <encode_args.h>

Public Member Functions

 EncodedMessage (pw_tokenizer_Token token, pw_tokenizer_ArgTypes types, va_list args)
 
const std::byte * data () const
 The binary-encoded tokenized message.
 
const uint8_t * data_as_uint8 () const
 Returns data() as a pointer to uint8_t instead of std::byte.
 
size_t size () const
 The size of the encoded tokenized message in bytes.
 

Detailed Description

template<size_t kMaxSizeBytes>
class pw::tokenizer::EncodedMessage< kMaxSizeBytes >

Encodes a tokenized message to a fixed size buffer. This class is used to encode tokenized messages passed in from tokenization macros.

To use pw::tokenizer::EncodedMessage, construct it with the token, argument types, and va_list from the variadic arguments:

void SendLogMessage(span<std::byte> log_data);
extern "C" void TokenizeToSendLogMessage(pw_tokenizer_Token token,
pw_tokenizer_ArgTypes types,
...) {
va_list args;
va_start(args, types);
EncodedMessage encoded_message(token, types, args);
va_end(args);
SendLogMessage(encoded_message); // EncodedMessage converts to span
}
Definition: encode_args.h:107

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