1 #ifndef ISIMUD_EXCHANGES_COMMON_MIT_PROCESSING_RULES_HPP
2 #define ISIMUD_EXCHANGES_COMMON_MIT_PROCESSING_RULES_HPP
22 #include "../../common/processing_rules.hpp"
24 #include "core/msm.hpp"
37 template<
class SrcMsgDetails,
class DestMsgDetails>
38 class client_to_exchange_transformations final
42 client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails>,
49 client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails>,
50 typename SrcMsgDetails::client_to_exchange_messages_t
52 using src_msg_details_t=
typename base_t::src_msg_details_t;
53 using dest_msg_details_t=
typename base_t::dest_msg_details_t;
54 using ref_data=
typename dest_msg_details_t::ref_data;
57 : ref_data_(rd), msm(ref_data_, ref_data_, ref_data_, ref_data_) {
60 : base_t(v), ref_data_(v.ref_data_), msm(v.msm) {
67 bool process_msg(
typename src_msg_details_t::msg_buffer_t
const &buff, SktT &exchg_skt, SktT &dest_skt);
72 struct state_machine_t;
75 ref_data
const &ref_data_;
79 template<
class SrcMsgDetails,
class DestMsgDetails>
inline std::ostream &
80 operator<<(
std::ostream &os, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails>
const &ec)
noexcept(
false);
87 template<
class SrcMsgDetails,
class DestMsgDetails>
88 class exchange_to_client_transformations final
92 exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails>,
99 exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails>,
100 typename SrcMsgDetails::exchange_to_client_messages_t
102 using src_msg_details_t=
typename base_t::src_msg_details_t;
103 using dest_msg_details_t=
typename base_t::dest_msg_details_t;
104 using ref_data=
typename src_msg_details_t::ref_data;
108 business_msm(ref_data_, ref_data_, ref_data_, ref_data_),
109 admin_msm(business_msm, business_msm, business_msm, business_msm, business_msm) {
112 : base_t(v), ref_data_(v.ref_data_), business_msm(v.business_msm), admin_msm(v.admin_msm) {
118 template<
class SktT,
class ClientCxn>
119 bool process_msg(
typename src_msg_details_t::msg_buffer_t
const &buff, SktT &exchg_skt, ClientCxn &client_skt);
124 struct business_state_machine_t;
125 struct admin_state_machine_t;
126 using business_machine=libjmmcg::
msm::
unroll::
machine<business_state_machine_t>;
129 ref_data
const &ref_data_;
130 const business_machine business_msm;
131 const admin_machine admin_msm;
134 template<
class SrcMsgDetails,
class DestMsgDetails>
inline std::ostream &
135 operator<<(
std::ostream &os, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails>
const &ec)
noexcept(
false);
142 template<
class SrcMsgDetails>
143 class simulator_responses final :
public exchanges::common::
simulator_responses<SrcMsgDetails, simulator_responses<SrcMsgDetails>> {
146 using msg_details_t=
typename base_t::msg_details_t;
156 : base_t(), msm{
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this)} {
159 : base_t(sr), msm{
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this),
std::ref(*
this)} {
165 template<
class SktT,
class ClientCxn>
166 bool process_msg(
typename msg_details_t::msg_buffer_t
const &buff, SktT &exchg_skt, ClientCxn &client_cxn);
171 struct state_machine_t;
177 template<
class SrcMsgDetails>
inline std::ostream &
178 operator<<(
std::ostream &os, simulator_responses<SrcMsgDetails>
const &ec)
noexcept(
false);