ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
Loading...
Searching...
No Matches
b2bits::delegate_detail::Invoker Struct Reference

Invoker utility for dispatching calls to handler objects. More...

Detailed Description

Invoker utility for dispatching calls to handler objects.

Provides static methods for:

  • Creating wrapper functions that invoke handler methods
  • Assigning these wrappers to callbacks (with SFINAE checks)

The invoker bridges the gap between type-erased function pointers and the strongly-typed handler object.

#include <core/src/impl/Delegate.h>

Static Public Member Functions

template<typename Handler, typename R, typename... Args>
static R invoke (void *mem, Args... args)
 Invoke a handler method with provided arguments.
template<typename Handler, typename Callback, typename VoidPtr, typename... Args>
static std::enable_if< IsInvocableR< typenameCallback::return_type, Handler, Args... >, void >::type assign (Callback &cb, ArgsPack< VoidPtr, Args... >)
 Assign invoker to callback (enabled case).
template<typename Handler, typename Callback, typename VoidPtr, typename... Args>
static std::enable_if<!IsInvocableR< typenameCallback::return_type, Handler, Args... >, void >::type assign (Callback &cb, ArgsPack< VoidPtr, Args... >)
 Assign invoker to callback (disabled case).

Member Function Documentation

◆ assign() [1/2]

template<typename Handler, typename Callback, typename VoidPtr, typename... Args>
std::enable_if<!IsInvocableR< typenameCallback::return_type, Handler, Args... >, void >::type b2bits::delegate_detail::Invoker::assign ( Callback & cb,
ArgsPack< VoidPtr, Args... >  )
inlinestatic

Assign invoker to callback (disabled case).

If the handler is NOT invocable with the callback's signature, this overload is selected and does nothing. This allows a handler to support only some of the delegate's signatures.

Template Parameters
HandlerType of the handler object
CallbackType of the callback
VoidPtrvoid* type (first parameter)
ArgsRemaining argument types
Parameters
cbCallback (unused)
ArgsPackfor template argument deduction
Note
Only enabled if Handler is NOT invocable with Args... -> return_type

◆ assign() [2/2]

template<typename Handler, typename Callback, typename VoidPtr, typename... Args>
std::enable_if< IsInvocableR< typenameCallback::return_type, Handler, Args... >, void >::type b2bits::delegate_detail::Invoker::assign ( Callback & cb,
ArgsPack< VoidPtr, Args... >  )
inlinestatic

Assign invoker to callback (enabled case).

If the handler is invocable with the callback's signature, creates a wrapper function and assigns it to the callback.

Template Parameters
HandlerType of the handler object
CallbackType of the callback to assign
VoidPtrvoid* type (first parameter)
ArgsRemaining argument types
Parameters
cbCallback to assign to
ArgsPackfor template argument deduction
Note
Only enabled if Handler is invocable with Args... -> return_type

References invoke().

Referenced by b2bits::delegate_detail::ForEach< Callbacks >::assign().

◆ invoke()

template<typename Handler, typename R, typename... Args>
R b2bits::delegate_detail::Invoker::invoke ( void * mem,
Args... args )
inlinestatic

Invoke a handler method with provided arguments.

Static function that casts the void* to the handler type and invokes its operator() with the arguments.

Template Parameters
HandlerType of the handler object
RReturn type
ArgsArgument types
Parameters
memPointer to handler object (stored in delegate)
argsArguments to forward to handler
Returns
Result of handler invocation

Referenced by assign().


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