algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::conformance Namespace Reference

The compile-time check behind ATL_ASSERT_BROKER(Client). More...

Classes

struct  PlainCallback
 A completion handler with no associated executor (a plain callback). More...
struct  MoveOnlyCallback
 A plain callback that cannot be copied. More...

Functions

InstrumentId probe_instrument ()
 Returns the placeholder instrument the checks call operations with.
template<typename Client, typename Token>
void call_claimed_async_verbs (BrokerSession< Client > &session, const typename BrokerSession< Client >::Ref &ref)
 Calls every operation an asynchronous session's capabilities claim; compiled, never run.
template<typename Client>
void call_claimed_blocking_verbs (BlockingSession< Client > &session, const typename BlockingSession< Client >::Ref &ref)
 Calls every operation a blocking session's capabilities claim; compiled, never run.
template<typename Client>
constexpr bool claimed_verbs_compile ()
 Compiles the operation checks for a client.

Detailed Description

The compile-time check behind ATL_ASSERT_BROKER(Client).

It calls every operation the client's capabilities claim, through a real session, with a plain callback, a move-only callback and use_future (or directly, for a blocking client), and reads every capability constant. Nothing runs. A missing member, a thunk with the wrong signature or one that copies its completion token, or an unanswered capability fails the build with the compiler's own message. Assert it once, in any one source file (a test is a good place):

ATL_ASSERT_BROKER(my::Client);
ATL_ASSERT_BROKER(my::BlockingClient);

It cannot prove run-time behaviour: that an asynchronous call completes exactly once and on the right executor, or that a claimed capability is true of the broker.

Function Documentation

◆ call_claimed_async_verbs()

template<typename Client, typename Token>
void algotradelib::conformance::call_claimed_async_verbs ( BrokerSession< Client > & session,
const typename BrokerSession< Client >::Ref & ref )

Calls every operation an asynchronous session's capabilities claim; compiled, never run.

Template Parameters
ClientThe broker client type.
TokenThe completion token type; a fresh one is moved into each call.
Parameters
sessionThe session.
refAn order reference.

Definition at line 79 of file broker_verbs.hpp.

Referenced by call_claimed_async_verbs(), and claimed_verbs_compile().

◆ call_claimed_blocking_verbs()

template<typename Client>
void algotradelib::conformance::call_claimed_blocking_verbs ( BlockingSession< Client > & session,
const typename BlockingSession< Client >::Ref & ref )

Calls every operation a blocking session's capabilities claim; compiled, never run.

Template Parameters
ClientThe broker client type.
Parameters
sessionThe session.
refAn order reference.

Definition at line 135 of file broker_verbs.hpp.

Referenced by call_claimed_blocking_verbs(), and claimed_verbs_compile().

◆ claimed_verbs_compile()

template<typename Client>
bool algotradelib::conformance::claimed_verbs_compile ( )
constexpr

Compiles the operation checks for a client.

Template Parameters
ClientThe broker client type.
Returns
Always true; a failing check is a compile error.

Definition at line 191 of file broker_verbs.hpp.

Referenced by claimed_verbs_compile().

◆ probe_instrument()

InstrumentId algotradelib::conformance::probe_instrument ( )
inline

Returns the placeholder instrument the checks call operations with.

Returns
An arbitrary instrument; nothing runs.

Definition at line 69 of file broker_verbs.hpp.

Referenced by call_claimed_async_verbs(), call_claimed_blocking_verbs(), and probe_instrument().