1 #ifndef ISIMUD_EXCHANGES_COMMON_CONNECTION_HPP
2 #define ISIMUD_EXCHANGES_COMMON_CONNECTION_HPP
24 #include "core/msg_processor.hpp"
26 #include <boost/mpl/end.hpp>
27 #include <boost/mpl/find.hpp>
32 template<
class MsgDetails,
class ConnPol>
36 using msg_details_t=MsgDetails;
38 using conn_pol_t=ConnPol;
39 using ctor_args=conn_pol_t;
50 connection(conn_pol_t
const &conn_pol, skt_mgr_t::socket_priority priority,
std::size_t incoming_cpu);
59 typename std::enable_if<
61 typename boost::mpl::find<
typename msg_details_t::client_to_exchange_messages_t, Msg>::type,
62 typename boost::mpl::end<
typename msg_details_t::client_to_exchange_messages_t>::type
74 typename std::enable_if<
76 typename boost::mpl::find<
typename msg_details_t::exchange_to_client_messages_t, Msg>::type,
77 typename boost::mpl::end<
typename msg_details_t::exchange_to_client_messages_t>::type
94 template<
class MsgDetails,
class ConnPol>
inline std::ostream &
95 operator<<(
std::ostream &os,
connection<MsgDetails, ConnPol>
const &ec)
noexcept(
false);
98 template<
class ExchgToClientProcessingRules,
class ConnPol>
99 class connection_processor final {
102 using proc_rules_t=
typename msg_processor_t::proc_rules_t;
103 using msg_details_t=
typename proc_rules_t::src_msg_details_t;
105 using conn_pol_t=
typename connection_t::conn_pol_t;
106 using socket_t=
typename connection_t::socket_t;
107 using socket_priority=
typename connection_t::socket_priority;
108 using ctor_args=
typename connection_t::ctor_args;
110 connection_processor(ctor_args
const &details, socket_priority priority,
std::size_t incoming_cpu, proc_rules_t
const &proc_rules)
noexcept(
false);
113 template<
class ClientCxn,
class LatencyTimestamps>
117 assert(cxn_.socket().is_open());
118 return cxn_.socket();
124 return static_cast<
bool>(logged_on_);
130 std::atomic<
bool> logged_on_{
false};
131 msg_processor_t processor;
138 template<
class ExchgToClientProcessingRules,
class ConnPol>
inline std::ostream &
139 operator<<(
std::ostream &os, connection_processor<ExchgToClientProcessingRules, ConnPol>
const &ec)
noexcept(
false);