Class ReceiveMessage
Defined in File ReceiveMessage.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public felix::asyncmsg::InputMessage
Class Documentation
-
class ReceiveMessage : public felix::asyncmsg::InputMessage
A class that represents a message received over TCP.
Public Functions
-
explicit ReceiveMessage(const ReceiveMessageConfig &config)
Constructs a ReceiveMessage object with the given configuration.
Called by the createMessage function of the TcpSession.
- Parameters:
config – The configuration for the receive message containing the size
-
void toBuffers(std::vector<boost::asio::mutable_buffer> &buffers) override
Connects the message data to the network buffers.
This function is called by the asyncmsg library. It makes sure that once the message is received, the data is available in the Message object.
- Parameters:
buffers – Vector of network buffers
-
inline std::uint32_t typeId() const override
Returns the type ID of the message.
This library makes no use of different message types.
- Returns:
Type ID
-
inline std::uint32_t transactionId() const override
Returns the transaction ID of the message.
This library makes no use of transaction IDs.
- Returns:
Transaction ID
-
inline std::uint32_t msgSize() const
Gets the size of the received message.
This is the size of the entire message including the header not just the data.
- Returns:
The size of the receive message
-
inline std::span<std::uint8_t> data()
Gets a span of the data in the received message.
This function returns only the data not the header.
- Returns:
A span of the data in the receive message
-
struct Message
Represents a received message.
Public Members
-
std::vector<std::uint8_t> data
The data of the message.
-
std::vector<std::uint8_t> data
-
struct ReceiveMessageConfig
Configuration for the receive message.
-
explicit ReceiveMessage(const ReceiveMessageConfig &config)