1 #ifndef ISIMUD_EXCHANGES_COMMON_FIX_PROCESSING_RULES_HPP
2 #define ISIMUD_EXCHANGES_COMMON_FIX_PROCESSING_RULES_HPP
22 #include "../../common/processing_rules.hpp"
24 #include "core/msm.hpp"
29 template<
class SrcMsgDetails,
class DestMsgDetails>
30 class client_to_exchange_transformations final :
public exchanges::common::
message_responses<SrcMsgDetails, DestMsgDetails, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails>,
typename SrcMsgDetails::
client_to_exchange_messages_t> {
32 using base_t=exchanges::common::
message_responses<SrcMsgDetails, DestMsgDetails, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails>,
typename SrcMsgDetails::client_to_exchange_messages_t>;
33 using src_msg_details_t=
typename base_t::src_msg_details_t;
34 using dest_msg_details_t=
typename base_t::dest_msg_details_t;
40 bool process_msg(
typename src_msg_details_t::msg_buffer_t
const &buff, SktT &exchg_skt, SktT &dest_skt);
45 struct state_machine_t;
48 static inline const machine msm{};
51 template<
class SrcMsgDetails,
class DestMsgDetails>
inline std::ostream &
52 operator<<(
std::ostream &os, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails>
const &ec)
noexcept(
false);
58 template<
class SrcMsgDetails,
class DestMsgDetails>
59 class exchange_to_client_transformations final :
public exchanges::common::
message_responses<SrcMsgDetails, DestMsgDetails, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails>,
typename SrcMsgDetails::
exchange_to_client_messages_t> {
61 using base_t=exchanges::common::
message_responses<SrcMsgDetails, DestMsgDetails, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails>,
typename SrcMsgDetails::exchange_to_client_messages_t>;
62 using src_msg_details_t=
typename base_t::src_msg_details_t;
63 using dest_msg_details_t=
typename base_t::dest_msg_details_t;
68 template<
class SktT,
class ClientCxn>
69 bool process_msg(
typename src_msg_details_t::msg_buffer_t
const &buff, SktT &exchg_skt, ClientCxn &client_skt);
74 struct business_state_machine_t;
75 struct admin_state_machine_t;
76 using business_machine=libjmmcg::
msm::
unroll::
machine<business_state_machine_t>;
79 static inline const business_machine business_msm{};
80 static inline const admin_machine admin_msm{business_msm, business_msm, business_msm, business_msm};
83 template<
class SrcMsgDetails,
class DestMsgDetails>
inline std::ostream &
84 operator<<(
std::ostream &os, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails>
const &ec)
noexcept(
false);
90 template<
class SrcMsgDetails>
91 class simulator_responses final :
public exchanges::common::
simulator_responses<SrcMsgDetails, simulator_responses<SrcMsgDetails>> {
93 using base_t=exchanges::common::
simulator_responses<SrcMsgDetails, simulator_responses<SrcMsgDetails>>;
94 using msg_details_t=
typename base_t::msg_details_t;
96 static inline constexpr Reason_t
logout_reason{
'U',
's',
'e',
'r',
' ',
'l',
'o',
'g',
'o',
'u',
't',
' ',
'r',
'e',
'c',
'e',
'i',
'v',
'e',
'd'};
103 : base_t(), msm{
std::ref(*
this),
std::ref(*
this)} {
106 : base_t(sr), msm{
std::ref(*
this),
std::ref(*
this)} {
113 bool process_msg(
typename msg_details_t::msg_buffer_t
const &buff, SktT &exchg_skt, SktT &client_skt);
118 struct state_machine_t;
124 template<
class SrcMsgDetails>
inline std::ostream &
125 operator<<(
std::ostream &os, simulator_responses<SrcMsgDetails>
const &ec)
noexcept(
false);