MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Transitive::Protocol::DelimiterFramer Class Reference

Splits a byte stream at a terminator of one or more bytes, whatever the chunking. More...

#include <Framing.hpp>

Collaboration diagram for MayaFlux::Transitive::Protocol::DelimiterFramer:

Public Member Functions

size_t buffered () const noexcept
 Bytes held for a message that has not ended.
 DelimiterFramer (std::span< const uint8_t > terminator, size_t max_message=default_max_line)
 DelimiterFramer (std::string_view terminator, size_t max_message=default_max_line)
template<MessageSink Sink>
FrameReport push (Message bytes, Sink &&sink)
void reset () noexcept
 Drop any partial message and any discard in progress.

Private Member Functions

bool ends_with_terminator () const

Private Attributes

bool m_discarding { false }
size_t m_max_message
std::vector< uint8_t > m_pending
std::vector< uint8_t > m_terminator

Detailed Description

Splits a byte stream at a terminator of one or more bytes, whatever the chunking.

A message is the bytes before each terminator, such as "\r" for a modem, ">" for an ELM327 or "\r\n". Empty messages are delivered. A message longer than max_message is dropped and the framer resumes after the next terminator. An empty terminator is taken as LF.

Not thread safe: one thread at a time per framer.

Definition at line 381 of file Framing.hpp.


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