CppWAMP
C++11 client library for the WAMP protocol
wamp::SimpleCoroEventUnpacker< TSlot, TArgs > Class Template Reference

Wrapper around an event slot which automatically unpacks positional payload arguments. More...

#include <cppwamp/corounpacker.hpp>

Public Types

using Slot = TSlot
 The function type to be wrapped.
 

Public Member Functions

 SimpleCoroEventUnpacker (Slot slot)
 Constructor taking a callable target.
 
void operator() (Event event) const
 Spawns a new coroutine and executes the stored event slot. More...
 

Related Functions

(Note that these are not member functions.)

template<typename... TArgs, typename TSlot >
SimpleCoroEventUnpacker< DecayedSlot< TSlot >, TArgs... > simpleCoroEvent (TSlot &&slot)
 

Detailed Description

template<typename TSlot, typename... TArgs>
class wamp::SimpleCoroEventUnpacker< TSlot, TArgs >

Wrapper around an event slot which automatically unpacks positional payload arguments.

The wamp::simpleCoroEvent convenience function should be used to construct instances of SimpleCoroEventUnpacker. This class differs from CoroEventUnpacker in that the slot type is not expected to take an Event as the first parameter.

See also
wamp::simpleCoroEvent
Simple Coroutine Event Slots
Template Parameters
TSlotFunction type to be wrapped. Must have the signature void function(TArgs..., boost::asio::yield_context).
TArgsList of static types the event slot expects as arguments preceding the boost::asio::yield_context parameter.

Member Function Documentation

◆ operator()()

template<typename S , typename... A>
void wamp::SimpleCoroEventUnpacker< S, A >::operator() ( Event  event) const

Spawns a new coroutine and executes the stored event slot.

The coroutine will be spawned using event.executor(). The event.args() positional arguments will be unpacked and passed to the stored event slot as parameters.

Friends And Related Function Documentation

◆ simpleCoroEvent()

template<typename... TArgs, typename TSlot >
SimpleCoroEventUnpacker< DecayedSlot< TSlot >, TArgs... > simpleCoroEvent ( TSlot &&  slot)
related

Converts an unpacked event slot into a regular slot than can be passed to Session::subscribe. This function differs from unpackedCoroEvent in that the slot type is not expected to take an Event as the first parameter.

See also
Simple Coroutine Event Slots
Returns
An SimpleCoroEventUnpacker that wraps the the given slot.
Template Parameters
TArgsList of static types the event slot expects as arguments, preceding the boost::asio::yield_context parameter.
TSlot(deduced) Function type to be converted. Must have the signature void function(TArgs..., boost::asio::yield_context).

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