Poplar and PopLibs
|
Wrapper for StreamCallback instances. More...
#include <StreamCallback.hpp>
Public Member Functions | |
template<class CallbackImpl , typename = typename std::enable_if< std::is_base_of<StreamCallback, CallbackImpl>::value || std::is_base_of<StreamCallbackWithMetadata, CallbackImpl>::value>::type> | |
StreamCallbackHandle (std::unique_ptr< CallbackImpl > f) | |
Constructs a handle from an instance of a stream callback implementation. More... | |
template<class F , typename = typename std::enable_if< traits::is_callback<F>::value>::type> | |
StreamCallbackHandle (F &&f) | |
Constructs a handle from a callable instance. More... | |
operator std::unique_ptr< StreamCallbackBase > () && | |
Extracts the callback implementation from the handle. | |
operator std::unique_ptr< StreamCallback > () && | |
Extract callback implementation after casting to StreamCallback. More... | |
operator std::unique_ptr< StreamCallbackWithMetadata > () && | |
Extract callback implementation after casting to StreamCallbackWithMetadata. More... | |
Wrapper for StreamCallback instances.
Provides backwards compatibility with C++ lambda expressions and std::function
instances.
|
inline |
Constructs a handle from an instance of a stream callback implementation.
This constructor only participates in overload resolution if CallbackImpl is derived from either poplar::StreamCallback or poplar::StreamCallbackWithMetadata (in other words, it is an implementation of the callback interface).
|
inline |
Constructs a handle from a callable instance.
This constructor only participates in overload resolution if F
satisfies the requirements of a Function Object. It transforms f
into a LegacyStreamCallback implementation.
poplar::StreamCallbackHandle::operator std::unique_ptr< StreamCallback > | ( | ) | && |
Extract callback implementation after casting to StreamCallback.
This function will return the callback only if the pointer matches StreamCallback and does not match StreamCallbackWithMetadata. Otherwise nullptr is returned.
poplar::StreamCallbackHandle::operator std::unique_ptr< StreamCallbackWithMetadata > | ( | ) | && |
Extract callback implementation after casting to StreamCallbackWithMetadata.
This function will return the callback only if the pointer matches StreamCallbackWithMetadata. Otherwise nullptr is returned.