CppWAMP
C++11 client library for the WAMP protocol
|
Type-erases a multi-shot, copyable callback handler. More...
#include <cppwamp/anyhandler.hpp>
Public Types | |
using | Executor = AnyCompletionExecutor |
Polymorphic wrapper around the executor associated with this handler. | |
using | CancellationSlot = boost::asio::cancellation_slot |
Cancellation slot type used by this handler. | |
using | executor_type = Executor |
Asio-conformant type alias. | |
using | cancellation_slot_type = CancellationSlot |
Asio-conformant type alias. | |
Public Member Functions | |
AnyReusableHandler ()=default | |
Default constructor. | |
AnyReusableHandler (const AnyReusableHandler &)=default | |
Copy constructor. | |
AnyReusableHandler (AnyReusableHandler &&) noexcept=default | |
Move constructor. | |
template<typename S , typename std::enable_if< otherConstructible< S >(), int >::type = 0> | |
AnyReusableHandler (const AnyReusableHandler< S > &rhs) | |
Constructor copying another AnyReusableHandler with a different signature. More... | |
template<typename S , typename std::enable_if< otherConstructible< S >(), int >::type = 0> | |
AnyReusableHandler (AnyReusableHandler< S > &&rhs) noexcept | |
Constructor moving another AnyReusableHandler with a different signature. More... | |
template<typename F , typename std::enable_if< fnConstructible< F >(), int >::type = 0> | |
AnyReusableHandler (F &&handler) | |
Constructor taking a callable entity. More... | |
AnyReusableHandler (std::nullptr_t) noexcept | |
Constructs an empty AnyReusableHandler. | |
AnyReusableHandler & | operator= (std::nullptr_t) noexcept |
Renders an AnyReusableHandler empty. | |
AnyReusableHandler & | operator= (const AnyReusableHandler &)=default |
Copy assignment. | |
AnyReusableHandler & | operator= (AnyReusableHandler &&) noexcept=default |
Move assignment. | |
void | swap (AnyReusableHandler &rhs) noexcept |
Swaps contents with another AnyReusableHandler. | |
operator bool () const noexcept | |
Returns false iff the AnyReusableHandler is empty. | |
const Executor & | get_executor () const |
Obtains the executor associated with this handler. | |
const CancellationSlot & | get_cancellation_slot () const |
Obtains the cancellation slot associated with this handler. | |
template<typename... Ts> | |
auto | operator() (Ts &&... args) const -> decltype(std::declval< Function >()(std::forward< Ts >(args)...)) |
Invokes the handler with the given arguments. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename S > | |
void | swap (AnyReusableHandler< S > &a, AnyReusableHandler< S > &b) noexcept |
Non-member swap. | |
template<typename S > | |
bool | operator== (const AnyReusableHandler< S > &f, std::nullptr_t) noexcept |
Returns true is the given handler is empty. | |
template<typename S > | |
bool | operator== (std::nullptr_t, const AnyReusableHandler< S > &f) noexcept |
Returns true is the given handler is empty. | |
template<typename S > | |
bool | operator!= (const AnyReusableHandler< S > &f, std::nullptr_t) noexcept |
Returns false is the given handler is empty. | |
template<typename S > | |
bool | operator!= (std::nullptr_t, const AnyReusableHandler< S > &f) noexcept |
Returns false is the given handler is empty. | |
Type-erases a multi-shot, copyable callback handler.
The executor associated with the type-erased handler can be obtained via boost::asio::get_associated_executor.
|
inline |
Constructor copying another AnyReusableHandler with a different signature.
Participates in overload resolution when std::is_constructible_v<std::function<TSignature>, std::function<S>>
is true.
|
inlinenoexcept |
Constructor moving another AnyReusableHandler with a different signature.
Participates in overload resolution when std::is_constructible_v<std::function<TSignature>, std::function<S>>
is true.
|
inline |
Constructor taking a callable entity.
Participates in overload resolution when
std::is_same_v<std::decay_t<F>, AnyReusableHandler<TSignature>>
is false, and,std::is_same_v<std::decay_t<F>, std::nullptr_t
is false, and,std::is_constructible_v<std::function<TSignature>, F>
is true.