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

Wrapper around a call coroutine 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

 CoroInvocationUnpacker (Slot slot)
 Constructor taking a callable target.
 
Outcome operator() (Invocation inv) const
 Spawns a new coroutine and executes the stored call slot. More...
 

Related Functions

(Note that these are not member functions.)

template<typename... TArgs, typename TSlot >
CoroInvocationUnpacker< DecayedSlot< TSlot >, TArgs... > unpackedCoroRpc (TSlot &&slot)
 

Detailed Description

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

Wrapper around a call coroutine slot which automatically unpacks positional payload arguments.

The wamp::unpackedCoroRpc convenience function should be used to construct instances of CoroInvocationUnpacker.

See also
wamp::unpackedCoroRpc
Unpacked Coroutine Call Slots
Template Parameters
TSlotFunction type to be wrapped. Must have the signature void function(Invocation, TArgs..., boost::asio::yield_context).
TArgsList of static types the call slot expects following the Invocation parameter, and preceding the boost::asio::yield_context parameter.

Member Function Documentation

◆ operator()()

template<typename S , typename... A>
Outcome wamp::CoroInvocationUnpacker< S, A >::operator() ( Invocation  inv) const

Spawns a new coroutine and executes the stored call slot.

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

Friends And Related Function Documentation

◆ unpackedCoroRpc()

template<typename... TArgs, typename TSlot >
CoroInvocationUnpacker< DecayedSlot< TSlot >, TArgs... > unpackedCoroRpc ( TSlot &&  slot)
related

Converts an unpacked call slot into a regular slot than can be passed to Session::enroll.

See also
Unpacked Coroutine Call Slots
Returns
A CoroInvocationUnpacker that wraps the the given slot.
Template Parameters
TArgsList of static types the call slot expects following the Invocation parameter, and preceding the boost::asio::yield_context parameter.
TSlot(deduced) Function type to be converted. Must have the signature Outcome function(Invocation, TArgs..., boost::asio::yield_context).

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