async_mqtt 5.0.0
Loading...
Searching...
No Matches
async_mqtt::basic_packet_variant< PacketIdBytes > Class Template Reference

#include <packet_variant.hpp>

Public Member Functions

template<typename Packet , std::enable_if_t< !std::is_same_v< std::decay_t< Packet >, basic_packet_variant< PacketIdBytes > > > * = nullptr>
 basic_packet_variant (Packet &&packet)
 constructor
 
template<typename Func >
auto visit (Func &&func) const &
 visit to variant
 
template<typename Func >
auto visit (Func &&func) &
 visit to variant
 
template<typename Func >
auto visit (Func &&func) &&
 visit to variant
 
template<typename T >
decltype(autoget ()
 Get by type. If not match, then throw std::bad_variant_access exception.
 
template<typename T >
decltype(autoget () const
 Get by type. If not match, then throw std::bad_variant_access exception.
 
template<typename T >
decltype(autoget_if ()
 Get by type pointer.
 
template<typename T >
decltype(autoget_if () const
 Get by type pointer.
 
optional< control_packet_type > type () const
 Get control_packet_type.
 
std::vector< as::const_buffer > const_buffer_sequence () const
 Create const buffer sequence it is for boost asio APIs.
 

Related Symbols

(Note that these are not member symbols.)

using packet_variant = basic_packet_variant<2>
 type alias of basic_packet_variant (PacketIdBytes=2).
 

Detailed Description

template<std::size_t PacketIdBytes>
class async_mqtt::basic_packet_variant< PacketIdBytes >

@breif The varaint type of all packets and system_error

Constructor & Destructor Documentation

◆ basic_packet_variant()

template<std::size_t PacketIdBytes>
template<typename Packet , std::enable_if_t< !std::is_same_v< std::decay_t< Packet >, basic_packet_variant< PacketIdBytes > > > * = nullptr>
async_mqtt::basic_packet_variant< PacketIdBytes >::basic_packet_variant ( Packet && packet)
inline

constructor

Parameters
packetpacket

Member Function Documentation

◆ const_buffer_sequence()

template<std::size_t PacketIdBytes>
std::vector< as::const_buffer > async_mqtt::basic_packet_variant< PacketIdBytes >::const_buffer_sequence ( ) const
inline

Create const buffer sequence it is for boost asio APIs.

Returns
const buffer sequence

◆ get() [1/2]

template<std::size_t PacketIdBytes>
template<typename T >
decltype(auto) async_mqtt::basic_packet_variant< PacketIdBytes >::get ( )
inline

Get by type. If not match, then throw std::bad_variant_access exception.

Returns
actual packet

◆ get() [2/2]

template<std::size_t PacketIdBytes>
template<typename T >
decltype(auto) async_mqtt::basic_packet_variant< PacketIdBytes >::get ( ) const
inline

Get by type. If not match, then throw std::bad_variant_access exception.

Returns
actual packet

◆ get_if() [1/2]

template<std::size_t PacketIdBytes>
template<typename T >
decltype(auto) async_mqtt::basic_packet_variant< PacketIdBytes >::get_if ( )
inline

Get by type pointer.

Returns
actual packet pointer. If not match then return nullptr.

◆ get_if() [2/2]

template<std::size_t PacketIdBytes>
template<typename T >
decltype(auto) async_mqtt::basic_packet_variant< PacketIdBytes >::get_if ( ) const
inline

Get by type pointer.

Returns
actual packet pointer. If not match then return nullptr.

◆ type()

template<std::size_t PacketIdBytes>
optional< control_packet_type > async_mqtt::basic_packet_variant< PacketIdBytes >::type ( ) const
inline

Get control_packet_type.

Returns
If packet is stored then return its control_packet_type, If error then return nullopt.

◆ visit() [1/3]

template<std::size_t PacketIdBytes>
template<typename Func >
auto async_mqtt::basic_packet_variant< PacketIdBytes >::visit ( Func && func) &
inline

visit to variant

Parameters
funcVisitor function

◆ visit() [2/3]

template<std::size_t PacketIdBytes>
template<typename Func >
auto async_mqtt::basic_packet_variant< PacketIdBytes >::visit ( Func && func) &&
inline

visit to variant

Parameters
funcVisitor function

◆ visit() [3/3]

template<std::size_t PacketIdBytes>
template<typename Func >
auto async_mqtt::basic_packet_variant< PacketIdBytes >::visit ( Func && func) const &
inline

visit to variant

Parameters
funcVisitor function

Friends And Related Symbol Documentation

◆ packet_variant

template<std::size_t PacketIdBytes>
using packet_variant = basic_packet_variant<2>
related

type alias of basic_packet_variant (PacketIdBytes=2).

Template Parameters
Rolerole for packet sendable checking
NextLayerJust next layer for basic_endpoint. mqtt, mqtts, ws, and wss are predefined.

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