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

Classes

struct  LCH
 Linear class hierarchy node (recursive case). More...
struct  LCH< T >
 Linear class hierarchy node (base case). More...
struct  ArgsPack
 Type list wrapper for function arguments. More...
struct  CallbackPtr
 Type-erased callback storage. More...
struct  MakePtr
 Metafunction to create CallbackPtr from function signature. More...
struct  MakePtr< R(Args...)>
 Specialization of MakePtr for function types. More...
struct  Callbacks
 Metafunction to create callbacks hierarchy from signatures. More...
struct  Invoker
 Invoker utility for dispatching calls to handler objects. More...
struct  ForEach
 Recursively assign handler to all callbacks in hierarchy. More...
struct  ForEach< void >
 ForEach specialization for base case (void parent). More...
struct  Delete
 Sentinel type for handler destruction. More...

Functions

template<class Callbacks, class Decl>
constexpr bool is_invocable ()
 Check if callbacks hierarchy supports a specific signature (compile-time).
template<class Decl, class Callbacks>
std::enable_if< is_invocable< Callbacks, Decl >(), bool >::type is_assigned (const Callbacks &cbs)
 Check if a callback is assigned for a specific signature (runtime).
template<class Decl, class Callbacks>
std::enable_if< is_invocable< Callbacks, Decl >(), void >::type clear (Callbacks &cbs)
 Clear (nullify) a callback for a specific signature.

Class Documentation

◆ b2bits::delegate_detail::ArgsPack

struct b2bits::delegate_detail::ArgsPack
template<typename T, typename... Args>
struct b2bits::delegate_detail::ArgsPack< T, Args >

Type list wrapper for function arguments.

Wraps a list of argument types for passing to template metaprogramming utilities. Used to carry function signature information through the type system.

Template Parameters
TFirst argument type
ArgsRemaining argument types

◆ b2bits::delegate_detail::MakePtr

struct b2bits::delegate_detail::MakePtr
template<class T>
struct b2bits::delegate_detail::MakePtr< T >

Metafunction to create CallbackPtr from function signature.

Transforms a function signature (e.g., void(int, string)) into a CallbackPtr type with an additional void* parameter for handler access.

Template Parameters
TFunction signature

◆ b2bits::delegate_detail::MakePtr< R(Args...)>

struct b2bits::delegate_detail::MakePtr< R(Args...)>
template<class R, class... Args>
struct b2bits::delegate_detail::MakePtr< R(Args...)>

Specialization of MakePtr for function types.

Extracts return type and arguments from function signature and creates a CallbackPtr with void* prepended to arguments.

Template Parameters
RReturn type
ArgsArgument types
Class Members
typedef CallbackPtr< R, void *, Args... > type CallbackPtr<R, void*, Args...> CallbackPtr with void* prepended.

◆ b2bits::delegate_detail::Callbacks

struct b2bits::delegate_detail::Callbacks
template<class... Args>
struct b2bits::delegate_detail::Callbacks< Args >

Metafunction to create callbacks hierarchy from signatures.

Takes multiple function signatures and creates a linear class hierarchy (LCH) of CallbackPtr types, one for each signature.

Template Parameters
ArgsFunction signatures (e.g., void(int), void(string))
Class Members
typedef type... > type LCH<typename MakePtr<Args>::type...> LCH of all callbacks.

◆ b2bits::delegate_detail::Delete

struct b2bits::delegate_detail::Delete

Sentinel type for handler destruction.

Special empty type used as a signature for the destructor callback. The delegate uses void(Delete) as a signature to store a function that destroys the handler object.

Function Documentation

◆ clear()

template<class Decl, class Callbacks>
std::enable_if< is_invocable< Callbacks, Decl >(), void >::type b2bits::delegate_detail::clear ( Callbacks & cbs)

◆ is_assigned()

template<class Decl, class Callbacks>
std::enable_if< is_invocable< Callbacks, Decl >(), bool >::type b2bits::delegate_detail::is_assigned ( const Callbacks & cbs)

Check if a callback is assigned for a specific signature (runtime).

Casts to the appropriate CallbackPtr and checks if its function pointer is not nullptr.

Template Parameters
DeclFunction declaration to check (e.g., void(int))
CallbacksType of the callbacks hierarchy
Parameters
cbsCallbacks hierarchy instance
Returns
true if callback is assigned and non-null
Note
Only enabled if the signature is supported (SFINAE)

Referenced by b2bits::Delegate< void(Session *, const Instrument *, Seqnum, const SystemEvent *), void(Session *, const Instrument *, Seqnum, const OrderBookState *), void(Session *, const Instrument *, Seqnum, const OrderbookDirectory *), void(Session *, const Instrument *, Seqnum, const AddOrder *), void(Session *, const Instrument *, Seqnum, const OrderExecuted *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const OrderExecutedWithPrice *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const OrderCancelMessage *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const OrderReplace *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const Trade *), void(Session *, const Instrument *, Seqnum, const ExecutionDone *), void(Session *, const Instrument *, Seqnum, const Information *), void(Session *, const Instrument *, Seqnum, const BrokenTrade *), void(Session *, const Instrument *, Timestamp timestamp, const Instrument::BookLevelUpdate &), void(Session *, EOP), void(Session *, Seqnum, const OrderbookDirectory *), void(Session *, Event)>::is_assigned().

◆ is_invocable()

template<class Callbacks, class Decl>
bool b2bits::delegate_detail::is_invocable ( )
constexpr

Check if callbacks hierarchy supports a specific signature (compile-time).

Uses std::is_assignable to check if the Callbacks hierarchy contains a callback matching the specified function declaration.

Template Parameters
CallbacksType of the callbacks hierarchy
DeclFunction declaration to check (e.g., void(int))
Returns
true if the signature is supported

Referenced by b2bits::Delegate< void(Session *, const Instrument *, Seqnum, const SystemEvent *), void(Session *, const Instrument *, Seqnum, const OrderBookState *), void(Session *, const Instrument *, Seqnum, const OrderbookDirectory *), void(Session *, const Instrument *, Seqnum, const AddOrder *), void(Session *, const Instrument *, Seqnum, const OrderExecuted *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const OrderExecutedWithPrice *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const OrderCancelMessage *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const OrderReplace *, const Instrument::Order *), void(Session *, const Instrument *, Seqnum, const Trade *), void(Session *, const Instrument *, Seqnum, const ExecutionDone *), void(Session *, const Instrument *, Seqnum, const Information *), void(Session *, const Instrument *, Seqnum, const BrokenTrade *), void(Session *, const Instrument *, Timestamp timestamp, const Instrument::BookLevelUpdate &), void(Session *, EOP), void(Session *, Seqnum, const OrderbookDirectory *), void(Session *, Event)>::is_invocable().