This source file includes following definitions.
- process_msg
- to_string
- process_msg
- to_string
- process_msg
- to_string
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include <functional>
22
23 namespace isimud { namespace exchanges { namespace FIX { namespace common {
24
25 template<class SrcMsgDetails, class DestMsgDetails, class SktT>
26 struct client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT>::state_machine_t : jmmcg::msm::unroll::state_transition_table<state_machine_t> {
27 using msm_base_t=jmmcg::msm::unroll::state_transition_table<state_machine_t>;
28 using row_t=jmmcg::msm::unroll::row_types<typename src_msg_details_t::ExgchgMsgTypes, typename dest_msg_details_t::MsgTypes_t>;
29 using transition_table=typename msm_base_t::template rows<
30
31
32 typename row_t::template row<
33 src_msg_details_t::MatchAll,
34 typename base_t::template send_reject<typename src_msg_details_t::Reject, false>,
35 dest_msg_details_t::Reject::type_const
36 >
37 >;
38 };
39
40 template<class SrcMsgDetails, class DestMsgDetails, class SktT>
41 inline bool
42 client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT>::process_msg(typename src_msg_details_t::msg_buffer_t const &buff, socket_t &client_skt) {
43 typename src_msg_details_t::Header_t const &hdr=reinterpret_cast<typename src_msg_details_t::Header_t const &>(buff);
44 const auto last_state=msm.process(hdr.type(), buff, client_skt);
45 return last_state==msg_details_t::Exit;
46 }
47
48 template<class SrcMsgDetails, class DestMsgDetails, class SktT> inline std::string
49 client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT>::to_string() const noexcept(false) {
50 return base_t::to_string();
51 }
52
53 template<class SrcMsgDetails, class DestMsgDetails, class SktT> inline std::ostream &
54 operator<<(std::ostream &os, client_to_exchange_transformations<SrcMsgDetails, DestMsgDetails, SktT> const &ec) noexcept(false) {
55 os<<ec.to_string();
56 return os;
57 }
58
59 template<class SrcMsgDetails, class DestMsgDetails, class SktT>
60 struct exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT>::state_machine_t : jmmcg::msm::unroll::state_transition_table<state_machine_t> {
61 using msm_base_t=jmmcg::msm::unroll::state_transition_table<state_machine_t>;
62 using row_t=jmmcg::msm::unroll::row_types<typename src_msg_details_t::MsgTypes_t, typename dest_msg_details_t::ExgchgMsgTypes>;
63 using transition_table=typename msm_base_t::template rows<
64
65
66
67 typename row_t::template row<
68 src_msg_details_t::ServerHeartbeat::type_const,
69 typename base_t::template just_send_to_exchg<typename src_msg_details_t::ClientHeartbeat>,
70 src_msg_details_t::ClientHeartbeat::type_const
71 >,
72 typename row_t::template row<
73 src_msg_details_t::Logout::type_const,
74 typename msm_base_t::no_op,
75 dest_msg_details_t::Exit
76 >,
77
78
79 typename row_t::template row<
80 src_msg_details_t::MatchAll,
81 typename base_t::template send_reject<typename dest_msg_details_t::Reject, true>,
82 dest_msg_details_t::Reject::type_const
83 >
84 >;
85 };
86
87 template<class SrcMsgDetails, class DestMsgDetails, class SktT>
88 inline bool
89 exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT>::process_msg(typename src_msg_details_t::msg_buffer_t const &buff, socket_t &client_skt) {
90 typename src_msg_details_t::Header_t const &hdr=reinterpret_cast<typename src_msg_details_t::Header_t const &>(buff);
91 const auto last_state=msm.process(hdr.type(), buff, client_skt);
92 return last_state==dest_msg_details_t::Exit;
93 }
94
95 template<class SrcMsgDetails, class DestMsgDetails, class SktT> inline std::string
96 exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT>::to_string() const noexcept(false) {
97 return base_t::to_string();
98 }
99
100 template<class SrcMsgDetails, class DestMsgDetails, class SktT> inline std::ostream &
101 operator<<(std::ostream &os, exchange_to_client_transformations<SrcMsgDetails, DestMsgDetails, SktT> const &ec) noexcept(false) {
102 os<<ec.to_string();
103 return os;
104 }
105
106 template<class SrcMsgDetails, class SktT>
107 struct simulator_responses<SrcMsgDetails, SktT>::state_machine_t : jmmcg::msm::unroll::state_transition_table<state_machine_t> {
108 using msm_base_t=jmmcg::msm::unroll::state_transition_table<state_machine_t>;
109 using row_t=jmmcg::msm::unroll::row_types<typename src_msg_details_t::ExgchgMsgTypes, typename msg_details_t::ExgchgMsgTypes>;
110 using transition_table=typename msm_base_t::template rows<
111
112
113
114 typename row_t::template row<
115 src_msg_details_t::ClientHeartbeat::type_const,
116 typename msm_base_t::no_op,
117 msg_details_t::ServerHeartbeat::type_const
118 >,
119
120
121 typename row_t::template row<
122 src_msg_details_t::MatchAll,
123 typename base_t::template send_reject<typename msg_details_t::Reject, true>,
124 msg_details_t::Reject::type_const
125 >
126 >;
127 };
128
129 template<class SrcMsgDetails, class SktT>
130 inline bool
131 simulator_responses<SrcMsgDetails, SktT>::process_msg(typename src_msg_details_t::msg_buffer_t const &buff, socket_t &exchg_skt, socket_t &client_skt) {
132 ++(this->sequenceNumber);
133 typename src_msg_details_t::Header_t const &hdr=reinterpret_cast<typename src_msg_details_t::Header_t const &>(buff);
134 const auto last_state=msm.process(hdr.type(), buff, exchg_skt, client_skt);
135 return last_state==msg_details_t::Exit;
136 }
137
138 template<class SrcMsgDetails, class SktT> inline std::string
139 simulator_responses<SrcMsgDetails, SktT>::to_string() const noexcept(false) {
140 return base_t::to_string();
141 }
142
143 template<class SrcMsgDetails, class SktT> inline std::ostream &
144 operator<<(std::ostream &os, simulator_responses<SrcMsgDetails, SktT> const &ec) noexcept(false) {
145 os<<ec.to_string();
146 return os;
147 }
148
149 } } } }