|
open62541pp 0.19.0
C++ wrapper of open62541
|
Open62541pp adapts the well-proven asynchronous model of (Boost) Asio. A key goal of Asio's asynchronous model is to support multiple composition mechanisms. This is achieved via completion tokens.
Open62541pp accepts completion tokens as the final argument of asynchronous operations.
Following completion tokens can be used (and described in more detail below):
opcua::useFuture to return a future object std::future<T>opcua::useDeferred to return a callable for deferred executionopcua::useDetached to detach the asynchronous operationopcua::AsyncResultIf the user passes a function object as the completion token, the asynchronous operation behaves as previously described: the operation begins, and when the operation completes the result is passed to the callback. The callback function must match the expected signature:
The callback is executed within the client's or server's event loop. Please make sure not to block the event loop. Waiting for asynchronous results within the callback will block the further execution of the event loop.
The special token opcua::useFuture can be passed as completion token to return a future object std::future<T>.
The token opcua::useDeferred is used to indicate that an asynchronous operation should return a function object to lazily launch the operation.
The token opcua::useDetached is used to indicate that an asynchronous operation is detached. That is, there is no completion handler waiting for the operation's result.
The opcua::AsyncResult trait is a customization point to define user-defined completion tokens via template specialization:
The trait's opcua::AsyncResult::initiate member function is called with three arguments:
void(T) or void(T&)Please have a look at implementations in async.hpp for further details.