CppWAMP
C++11 client library for the WAMP protocol
|
Wrapper around an event 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 | |
CoroEventUnpacker (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 > | |
CoroEventUnpacker< DecayedSlot< TSlot >, TArgs... > | unpackedCoroEvent (TSlot &&slot) |
Wrapper around an event coroutine slot which automatically unpacks positional payload arguments.
The wamp::unpackedCoroEvent convenience function should be used to construct instances of CoroEventUnpacker.
TSlot | Function type to be wrapped. Must have the signature void function(Event, TArgs..., boost::asio::yield_context) . |
TArgs | List of static types the event slot expects following the Event parameter and preceding the boost::asio::yield_context parameter. |
void wamp::CoroEventUnpacker< 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 additional parameters.
|
related |
Converts an unpacked event slot into a regular slot than can be passed to Session::subscribe. The slot will be executed within the context of a coroutine and will be given a boost::asio::yield_context
as the last call argument.
TArgs | List of static types the event slot expects following the Event parameter, and preceding the boost::asio::yield_context parameter. |
TSlot | (deduced) Function type to be converted. Must have the signature void function(Event, TArgs..., boost::asio::yield_context) . |