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

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

#include <cppwamp/corounpacker.hpp>

Public Types

using Slot = TSlot
 The function type to be wrapped.
 
using ResultType = TResult
 The static result type returned by the slot.
 

Public Member Functions

 SimpleCoroInvocationUnpacker (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 TResult , typename... TArgs, typename TSlot >
SimpleCoroInvocationUnpacker< DecayedSlot< TSlot >, TResult, TArgs... > simpleCoroRpc (TSlot &&slot)
 

Detailed Description

template<typename TSlot, typename TResult, typename... TArgs>
class wamp::SimpleCoroInvocationUnpacker< TSlot, TResult, TArgs >

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

The wamp::simpleCoroRpc convenience function should be used to construct instances of SimpleCoroInvocationUnpacker. This class differs from CoroInvocationUnpacker in that the slot type returns TResult and does not take an Invocation as the first parameter. The slot cannot defer the outcome of the RPC and must return a result immediately (or throw a wamp::Error).

See also
wamp::simpleCoroRpc
Simple Coroutine Call Slots
Template Parameters
TSlotFunction type to be wrapped. Must have the signature TResult function(TArgs..., boost::asio::yield_context).
TResultThe static result type returned by the slot (may be void).
TArgsList of static types the call slot expects as arguments, preceding the boost::asio::yield_context argument.

Member Function Documentation

◆ operator()()

template<typename S , typename R , typename... A>
Outcome wamp::SimpleCoroInvocationUnpacker< S, R, 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

◆ simpleCoroRpc()

template<typename TResult , typename... TArgs, typename TSlot >
SimpleCoroInvocationUnpacker< DecayedSlot< TSlot >, TResult, TArgs... > simpleCoroRpc ( TSlot &&  slot)
related

Converts an unpacked call slot into a regular slot than can be passed to Session::enroll. This function differs from unpackedCoroRpc in that the slot type returns TResult and is not expected to take an Invocation as the first parameter.

See also
Simple Coroutine Call Slots
Returns
A SimpleCoroInvocationUnpacker that wraps the the given slot.
Template Parameters
TArgsList of static types the call slot expects as arguments, preceding the boost::asio::yield_context argument.
TResultThe static result type returned by the slot (may be void).
TSlot(deduced) Function type to be converted. Must have the signature TResult function(TArgs..., boost::asio::yield_context).

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