1 #ifndef libjmmcg_isimud_exchanges_common_FIX_processing_rules_hpp
2 #define libjmmcg_isimud_exchanges_common_FIX_processing_rules_hpp
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "../../common/processing_rules.hpp"
25
26 #include "core/msm.hpp"
27
28 namespace isimud { namespace exchanges { namespace FIX { namespace common {
29
30
31 template<class SrcMsgDetails, class DestMsgDetails, class SktT>
32 class client_to_exchange_transformations final : public exchanges::common::message_responses<SrcMsgDetails, DestMsgDetails, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT>, typename SrcMsgDetails::client_to_exchange_messages_t, SktT> {
33 public:
34 using base_t=exchanges::common::message_responses<SrcMsgDetails, DestMsgDetails, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT>, typename SrcMsgDetails::client_to_exchange_messages_t, SktT>;
35 using src_msg_details_t=typename base_t::src_msg_details_t;
36 using dest_msg_details_t=typename base_t::dest_msg_details_t;
37 using msg_details_t=typename base_t::msg_details_t;
38 using socket_t=typename base_t::socket_t;
39
40
41
42
43 bool process_msg(typename src_msg_details_t::msg_buffer_t const &buff, socket_t &client_skt) override;
44
45 std::string to_string() const noexcept(false);
46
47 private:
48 struct state_machine_t;
49 using machine=jmmcg::msm::unroll::machine<state_machine_t>;
50
51 static inline const machine msm{};
52 };
53
54 template<class SrcMsgDetails, class DestMsgDetails, class SktT> inline std::ostream &
55 operator<<(std::ostream &os, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT> const &ec) noexcept(false);
56
57
58
59
60
61 template<class SrcMsgDetails, class DestMsgDetails, class SktT>
62 class exchange_to_client_transformations final : public exchanges::common::message_responses<SrcMsgDetails, DestMsgDetails, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT>, typename SrcMsgDetails::exchange_to_client_messages_t, SktT> {
63 public:
64 using base_t=exchanges::common::message_responses<SrcMsgDetails, DestMsgDetails, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT>, typename SrcMsgDetails::exchange_to_client_messages_t, SktT>;
65 using src_msg_details_t=typename base_t::src_msg_details_t;
66 using dest_msg_details_t=typename base_t::dest_msg_details_t;
67 using socket_t=typename base_t::socket_t;
68
69
70
71
72 bool process_msg(typename src_msg_details_t::msg_buffer_t const &buff, socket_t &client_skt) override;
73
74 std::string to_string() const noexcept(false);
75
76 private:
77 struct state_machine_t;
78 using machine=jmmcg::msm::unroll::machine<state_machine_t>;
79
80 static inline const machine msm{};
81 };
82
83 template<class SrcMsgDetails, class DestMsgDetails, class SktT> inline std::ostream &
84 operator<<(std::ostream &os, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT> const &ec) noexcept(false);
85
86
87
88
89
90 template<class SrcMsgDetails, class SktT>
91 class simulator_responses final : public exchanges::common::simulator_responses<SrcMsgDetails, simulator_responses<SrcMsgDetails, SktT>, SktT> {
92 public:
93 using base_t=exchanges::common::simulator_responses<SrcMsgDetails, simulator_responses<SrcMsgDetails, SktT>, SktT>;
94 using msg_details_t=typename base_t::msg_details_t;
95 using src_msg_details_t=msg_details_t;
96 using socket_t=typename base_t::socket_t;
97
98 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'};
99
100 static inline constexpr typename msg_details_t::SecurityID_t instrumentID{'1'};
101
102 static inline constexpr typename msg_details_t::SecurityID_t invalidInstrumentID{'2'};
103
104 simulator_responses()=default;
105 simulator_responses(simulator_responses const &sr) noexcept(true)
106 : base_t(sr), msm{std::ref(*this)} {
107 }
108
109
110
111
112 bool process_msg(typename src_msg_details_t::msg_buffer_t const &buff, socket_t &exchg_skt, socket_t &client_skt) override;
113
114 std::string to_string() const noexcept(false);
115
116 private:
117 struct state_machine_t;
118 using machine=jmmcg::msm::unroll::machine<state_machine_t>;
119
120 const machine msm{std::ref(*this)};
121 };
122
123 template<class SrcMsgDetails, class SktT> inline std::ostream &
124 operator<<(std::ostream &os, simulator_responses<SrcMsgDetails, SktT> const &ec) noexcept(false);
125
126 } } } }
127
128 #include "processing_rules_impl.hpp"
129
130 #endif