27#ifndef QB_IO_ASYNC_PROTOCOL_H
28#define QB_IO_ASYNC_PROTOCOL_H
32namespace qb::io::async {
45 bool _should_flush =
true;
79 virtual
void onMessage(std::
size_t size) noexcept = 0;
88 virtual
void reset() noexcept = 0;
126 return _should_flush;
145template <
typename _IO_>
162 friend typename _IO_::base_io_t;
virtual ~AProtocol()=default
Virtual destructor.
AProtocol(_IO_ &io) noexcept
Constructor that associates the protocol with an I/O component.
Definition protocol.h:177
AProtocol()=delete
Default constructor is deleted to ensure an I/O component is always associated.
virtual void onMessage(std::size_t size) noexcept=0
Processes a complete message from the input buffer of the associated I/O component.
virtual std::size_t getMessageSize() noexcept=0
Determines the size of the next complete message in the input buffer of the associated I/O component.
virtual void reset() noexcept=0
Resets the internal parsing state of the protocol.
_IO_ & _io
Reference to the I/O component instance that this protocol is associated with.
Definition protocol.h:166
Base interface for all message processing protocols.
Definition protocol.h:43
bool should_flush() const noexcept
Gets the flag indicating whether the protocol should flush the input buffer after processing a messag...
Definition protocol.h:125
virtual ~IProtocol()=default
Virtual destructor.
void set_should_flush(bool should_flush) noexcept
Sets the flag indicating whether the protocol should flush the input buffer after processing a messag...
Definition protocol.h:117
virtual void onMessage(std::size_t size) noexcept=0
Processes a complete message that has been identified in the input buffer.
void not_ok() noexcept
Marks the protocol as being in an invalid or non-operational state.
Definition protocol.h:109
virtual std::size_t getMessageSize() noexcept=0
Determines the size of the next complete message in the input buffer.
virtual void reset() noexcept=0
Resets the internal state of the protocol.
bool ok() const noexcept
Checks if the protocol is in a valid operational state.
Definition protocol.h:97
CRTP base class for managing bidirectional asynchronous I/O operations with protocol processing.
Definition io.h:938
Advanced type traits and metaprogramming utilities for the QB Framework.