C++ Actor Framework 0.19
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
caf::net::lp::default_trait Class Reference

A default trait type for binary protocols that uses frame as both input and output types and provides async::consumer_resource and async::producer_resource as input_resource and output_resource types, respectively. More...

#include <default_trait.hpp>

Public Types

using input_type = frame
 The input type of the application, i.e., what that flows from the socket to the application layer.
 
using output_type = frame
 The output type of the application, i.e., what flows from the application layer to the socket.
 
using input_resource = async::consumer_resource< input_type >
 A resource for consuming input_type elements.
 
using output_resource = async::producer_resource< output_type >
 A resource for producing output_type elements.
 
using accept_event = cow_tuple< input_resource, output_resource >
 An accept event from the server to transmit read and write handles.
 
using acceptor_resource = async::consumer_resource< accept_event >
 A resource for consuming accept events.
 

Public Member Functions

bool convert (const output_type &x, byte_buffer &bytes)
 Converts an output element to a byte buffer.
 
bool convert (const_byte_span bytes, input_type &x)
 Converts a byte buffer to an input element.
 
error last_error ()
 Returns the last error that occurred.
 

Detailed Description

A default trait type for binary protocols that uses frame as both input and output types and provides async::consumer_resource and async::producer_resource as input_resource and output_resource types, respectively.

Member Function Documentation

◆ convert() [1/2]

bool caf::net::lp::default_trait::convert ( const output_type x,
byte_buffer bytes 
)

Converts an output element to a byte buffer.

Parameters
xThe output element to convert.
bytesThe output byte buffer.
Returns
true on success, false otherwise.

◆ convert() [2/2]

bool caf::net::lp::default_trait::convert ( const_byte_span  bytes,
input_type x 
)

Converts a byte buffer to an input element.

Parameters
bytesThe input byte buffer.
xThe output input element.
Returns
true on success, false otherwise.

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