|
unilink
0.4.3
A simple C++ library for unified async communication
|
Abstract base class for message framing strategies. More...
#include <iframer.hpp>
Public Types | |
| using | MessageCallback = std::function< void(memory::ConstByteSpan)> |
| Register a callback to be invoked when a complete message is extracted. More... | |
Public Member Functions | |
| virtual | ~IFramer ()=default |
| virtual void | push_bytes (memory::ConstByteSpan data)=0 |
| Push raw bytes into the framer's internal buffer. More... | |
| virtual void | set_on_message (MessageCallback cb)=0 |
| virtual void | reset ()=0 |
| Reset internal state/buffer. More... | |
Abstract base class for message framing strategies.
Handles stream-based data segmentation (e.g., separating TCP/Serial streams into distinct messages by delimiters or packet patterns).
Definition at line 35 of file iframer.hpp.
| using unilink::framer::IFramer::MessageCallback = std::function<void(memory::ConstByteSpan)> |
Register a callback to be invoked when a complete message is extracted.
| cb | The callback function taking a span of the message bytes. |
Definition at line 54 of file iframer.hpp.
|
virtualdefault |
|
pure virtual |
Push raw bytes into the framer's internal buffer.
The framer will buffer the data and invoke the message callback whenever a complete message is extracted.
| data | The raw data chunk to process. |
Implemented in unilink::framer::PacketFramer, and unilink::framer::LineFramer.
|
pure virtual |
Reset internal state/buffer.
Should be called on connection loss or when resynchronization is needed.
Implemented in unilink::framer::PacketFramer, and unilink::framer::LineFramer.
|
pure virtual |
Implemented in unilink::framer::PacketFramer, and unilink::framer::LineFramer.