1 #ifndef libjmmcg_isimud_exchanges_FIX_5_0sp2_messages_hpp
2 #define libjmmcg_isimud_exchanges_FIX_5_0sp2_messages_hpp
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "config.h"
25 #include "types.hpp"
26 #include "../common/messages.hpp"
27
28 #include "core/max_min.hpp"
29
30 #include <boost/mpl/assert.hpp>
31 #include <boost/mpl/deref.hpp>
32 #include <boost/mpl/max_element.hpp>
33 #include <boost/mpl/min_element.hpp>
34 #include <boost/mpl/placeholders.hpp>
35 #include <boost/mpl/sizeof.hpp>
36 #include <boost/mpl/transform_view.hpp>
37 #include <boost/mpl/vector.hpp>
38 #include <boost/variant/variant.hpp>
39
40 #include <iosfwd>
41
42 namespace isimud { namespace exchanges { namespace FIX { namespace v5_0sp2 {
43
44 struct VersionSpecific {
45 static constexpr const common::underlying_fix_data_buffer::value_type fix_template_to_msg_type[]=JMMCG_FIX_v5_0sp2_MSG_VER JMMCG_FIX_MSG_BODY_LENGTH_TAG JMMCG_FIX_MSG_BODY_LENGTH_NULL JMMCG_FIX_MSG_TYPE_TAG;
46 enum : std::size_t {
47 fix_template_body_length_offset=sizeof(JMMCG_FIX_v5_0sp2_MSG_VER)-1+jmmcg::enum_tags::mpl::to_array<common::FieldsFast, common::FieldsFast::BodyLength>::size,
48 fix_template_msg_type_offset=sizeof(fix_template_to_msg_type)-1
49 };
50 static constexpr const char MsgVer[]=JMMCG_FIX_v5_0sp2_MSG_VER;
51
52
53
54
55
56
57 template<class Msg>
58 static constexpr bool is_valid(Msg const &m) noexcept(true);
59 };
60
61 struct LogonSpecific : public VersionSpecific {
62 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::LogonRequest>;
63
64
65
66
67
68
69 template<class Msg>
70 static bool is_valid(Msg const &m) noexcept(true);
71 };
72
73 struct LogoutRequestSpecific : public VersionSpecific {
74 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::Logout>;
75
76
77
78
79
80
81 template<class Msg>
82 static bool is_valid(Msg const &m) noexcept(true);
83 };
84
85 struct HeartbeatSpecific : public VersionSpecific {
86 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::Heartbeat>;
87
88
89
90
91
92
93 template<class Msg>
94 static bool is_valid(Msg const &m) noexcept(true) __attribute__((pure));
95 };
96
97 struct ServerHeartbeat : common::Message<HeartbeatSpecific> {
98 using base_t=common::Message<HeartbeatSpecific>;
99
100 ServerHeartbeat()
101 : base_t() {
102 pointer data=this->set_header<common::MsgTypes::Heartbeat>();
103 this->finalise_msg(data);
104 }
105 };
106
107 struct NewOrderSingleSpecific : public VersionSpecific {
108 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::NewOrderSingle>;
109
110
111
112
113
114
115 template<class Msg>
116 static bool is_valid(Msg const &m) noexcept(true);
117 };
118
119 struct OrderCancelRequestSpecific : public VersionSpecific {
120 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::OrderCancelRequest>;
121
122
123
124
125
126
127 template<class Msg>
128 static bool is_valid(Msg const &m) noexcept(true);
129 };
130
131 struct OrderCancelReplaceSpecific : public VersionSpecific {
132 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::OrderCancelReplaceRequest>;
133
134
135
136
137
138
139 template<class Msg>
140 static bool is_valid(Msg const &m) noexcept(true);
141 };
142
143 struct ExecutionReportSpecific : public VersionSpecific {
144 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::ExecutionReport>;
145
146
147
148
149
150
151 template<class Msg>
152 static bool is_valid(Msg const &m) noexcept(true);
153 };
154
155 struct LogonReplySpecific : public VersionSpecific {
156 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::LogonRequest>;
157
158
159
160
161
162
163 template<class Msg>
164 static bool is_valid(Msg const &m) noexcept(true);
165 };
166
167 struct LogoutSpecific : public VersionSpecific {
168 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::Logout>;
169
170
171
172
173
174
175 template<class Msg>
176 static bool is_valid(Msg const &m) noexcept(true);
177 };
178
179 struct CancelOrderSpecific : public VersionSpecific {
180 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::OrderCancelRequest>;
181
182
183
184
185
186
187 template<class Msg>
188 static bool is_valid(Msg const &m) noexcept(true);
189 };
190
191 struct BusinessMessageRejectSpecific : public VersionSpecific {
192 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::BusinessMessageReject>;
193
194
195
196
197
198
199 template<class Msg>
200 static bool is_valid(Msg const &m) noexcept(true);
201 };
202
203 struct ModifyOrderSpecific : public VersionSpecific {
204 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::OrderCancelReplaceRequest>;
205
206
207
208
209
210
211 template<class Msg>
212 static bool is_valid(Msg const &m) noexcept(true);
213 };
214
215 struct TradeCaptureReportSpecific : public VersionSpecific {
216 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::TradeCaptureReport>;
217
218
219
220
221
222
223 template<class Msg>
224 static bool is_valid(Msg const &m) noexcept(true);
225 };
226
227 struct TradeCaptureReportRequestSpecific : public VersionSpecific {
228 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::TradeCaptureReportRequest>;
229
230
231
232
233
234
235 template<class Msg>
236 static bool is_valid(Msg const &m) noexcept(true);
237 };
238
239 struct OrderAcknowledgementSpecific : public VersionSpecific {
240 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::ExecutionAcknowledgement>;
241
242
243
244
245
246
247 template<class Msg>
248 static bool is_valid(Msg const &m) noexcept(true);
249 };
250
251 struct OrderRejectedSpecific : public VersionSpecific {
252 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::Reject>;
253
254
255
256
257
258
259 template<class Msg>
260 static bool is_valid(Msg const &m) noexcept(true);
261 };
262
263 struct OrderModifiedSpecific : public VersionSpecific {
264 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::ExecutionReport>;
265
266
267
268
269
270
271 template<class Msg>
272 static bool is_valid(Msg const &m) noexcept(true);
273 };
274
275 struct OrderRestatedSpecific : public VersionSpecific {
276 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::ExecutionReport>;
277
278
279
280
281
282
283 template<class Msg>
284 static bool is_valid(Msg const &m) noexcept(true);
285 };
286
287 struct UserModifyRejectedSpecific : public VersionSpecific {
288 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::Reject>;
289
290
291
292
293
294
295 template<class Msg>
296 static bool is_valid(Msg const &m) noexcept(true);
297 };
298
299 struct OrderCancelledSpecific : public VersionSpecific {
300 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::ExecutionReport>;
301
302
303
304
305
306
307 template<class Msg>
308 static bool is_valid(Msg const &m) noexcept(true);
309 };
310
311 struct CancelRejectedSpecific : public VersionSpecific {
312 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::OrderCancelReject>;
313
314
315
316
317
318
319 template<class Msg>
320 static bool is_valid(Msg const &m) noexcept(true);
321 };
322
323 struct OrderExecutionSpecific : public VersionSpecific {
324 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::ExecutionReport>;
325
326
327
328
329
330
331 template<class Msg>
332 static bool is_valid(Msg const &m) noexcept(true);
333 };
334
335 struct TradeCaptureReportAckSpecific : public VersionSpecific {
336 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::TradeCaptureReportAck>;
337
338
339
340
341
342
343 template<class Msg>
344 static bool is_valid(Msg const &m) noexcept(true);
345 };
346
347 struct TradeCaptureReportRequestAckSpecific : public VersionSpecific {
348 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::TradeCaptureReportRequestAck>;
349
350
351
352
353
354
355 template<class Msg>
356 static bool is_valid(Msg const &m) noexcept(true);
357 };
358
359 struct RejectSpecific : public VersionSpecific {
360 using msg_type=jmmcg::enum_tags::mpl::to_array<common::MsgTypes, common::MsgTypes::Reject>;
361
362
363
364
365
366
367 template<class Msg>
368 static bool is_valid(Msg const &m) noexcept(true);
369 };
370
371
372
373
374 struct MsgTypes {
375
376 struct ref_data {};
377 using ref_data_t=ref_data const &;
378
379 using MsgTypes_t=typename common::MsgTypes_t;
380 using ExgchgMsgTypes=typename common::MsgTypes;
381 using UserName_t=common::UserName_t;
382 using Password_t=common::Password_t;
383 using Price_t=common::Price_t;
384 using ClientOrderID_t=common::ClientOrderID_t;
385 using SecurityID_t=common::SecurityID_t;
386 struct logon_args_t {};
387
388 using LogonRequest=common::Message<LogonSpecific>;
389 using Header_t=LogonRequest::Header_t;
390 using LogoutRequest=common::Message<LogoutRequestSpecific>;
391 using ClientHeartbeat=common::Message<HeartbeatSpecific>;
392 using ServerHeartbeat=v5_0sp2::ServerHeartbeat;
393 using NewOrderSingle=common::Message<NewOrderSingleSpecific>;
394 using OrderCancelRequest=common::Message<OrderCancelRequestSpecific>;
395 using OrderCancelReplace=common::Message<OrderCancelReplaceSpecific>;
396 using ExecutionReport=common::Message<ExecutionReportSpecific>;
397 using LogonReply=common::Message<LogonReplySpecific>;
398 using Logout=common::Message<LogoutSpecific>;
399 using CancelOrder=common::Message<CancelOrderSpecific>;
400 using ModifyOrder=common::Message<ModifyOrderSpecific>;
401 using TradeCaptureReport=common::Message<TradeCaptureReportSpecific>;
402 using TradeCaptureReportRequest=common::Message<TradeCaptureReportRequestSpecific>;
403 using OrderAcknowledgement=common::Message<OrderAcknowledgementSpecific>;
404 using OrderRejected=common::Message<OrderRejectedSpecific>;
405 using BusinessMessageReject=common::Message<BusinessMessageRejectSpecific>;
406 using OrderModified=common::Message<OrderModifiedSpecific>;
407 using OrderRestated=common::Message<OrderRestatedSpecific>;
408 using UserModifyRejected=common::Message<UserModifyRejectedSpecific>;
409 using OrderCancelled=common::Message<OrderCancelledSpecific>;
410 using CancelRejected=common::Message<CancelRejectedSpecific>;
411 using OrderExecution=common::Message<OrderExecutionSpecific>;
412 using TradeCaptureReportAck=common::Message<TradeCaptureReportAckSpecific>;
413 using TradeCaptureReportRequestAck=common::Message<TradeCaptureReportRequestAckSpecific>;
414 using Reject=common::Message<RejectSpecific>;
415
416 using NewOrder=NewOrderSingle;
417
418 static inline constexpr ExgchgMsgTypes MatchAll=ExgchgMsgTypes::MatchAll;
419 static inline constexpr ExgchgMsgTypes Exit=ExgchgMsgTypes::Exit;
420
421 using client_to_exchange_messages_t=boost::mpl::vector<
422 LogonRequest,
423 LogoutRequest,
424 ClientHeartbeat,
425 NewOrderSingle,
426 OrderCancelRequest,
427 OrderCancelReplace,
428 ModifyOrder,
429 TradeCaptureReport,
430 TradeCaptureReportRequest
431 >;
432 using exchange_to_client_messages_t=boost::mpl::vector<
433 LogonReply,
434 Logout,
435 ServerHeartbeat,
436 OrderAcknowledgement,
437 ExecutionReport,
438 OrderRejected,
439 BusinessMessageReject,
440 OrderModified,
441 OrderRestated,
442 UserModifyRejected,
443 OrderCancelled,
444 CancelRejected,
445 OrderExecution,
446 TradeCaptureReportAck,
447 TradeCaptureReportRequestAck,
448 Reject
449 >;
450 enum : std::size_t {
451 min_size_client_to_exchange_msg=sizeof(
452 boost::mpl::deref<
453 boost::mpl::min_element<
454 boost::mpl::transform_view<client_to_exchange_messages_t, boost::mpl::sizeof_<boost::mpl::_1> >
455 >::type::base
456 >::type
457 ),
458 max_size_client_to_exchange_msg=sizeof(
459 boost::mpl::deref<
460 boost::mpl::max_element<
461 boost::mpl::transform_view<client_to_exchange_messages_t, boost::mpl::sizeof_<boost::mpl::_1> >
462 >::type::base
463 >::type
464 ),
465 min_size_exchange_to_client_msg=sizeof(
466 boost::mpl::deref<
467 boost::mpl::min_element<
468 boost::mpl::transform_view<exchange_to_client_messages_t, boost::mpl::sizeof_<boost::mpl::_1> >
469 >::type::base
470 >::type
471 ),
472 max_size_exchange_to_client_msg=sizeof(
473 boost::mpl::deref<
474 boost::mpl::max_element<
475 boost::mpl::transform_view<exchange_to_client_messages_t, boost::mpl::sizeof_<boost::mpl::_1> >
476 >::type::base
477 >::type
478 ),
479 min_msg_size=jmmcg::min<std::size_t, min_size_client_to_exchange_msg, min_size_exchange_to_client_msg>::value,
480 max_msg_size=jmmcg::max<std::size_t, max_size_client_to_exchange_msg, max_size_exchange_to_client_msg>::value,
481 header_t_size=Header_t::header_t_size
482 };
483 BOOST_MPL_ASSERT_RELATION(max_msg_size, >=, header_t_size);
484
485 using underlying_fix_data_buffer=common::underlying_fix_data_buffer;
486 using msg_buffer_t=std::array<underlying_fix_data_buffer::value_type, max_msg_size>;
487 using client_to_exchange_messages_container=boost::make_variant_over<client_to_exchange_messages_t>::type;
488 using exchange_to_client_messages_container=boost::make_variant_over<exchange_to_client_messages_t>::type;
489
490
491 static constexpr std::uint64_t implied_decimal_places=common::implied_decimal_places;
492
493 static std::ostream &to_stream(std::ostream &) noexcept(false);
494 };
495
496
497
498
499 namespace tests {
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527 }
528
529 } } } }
530
531 #include "messages_impl.hpp"
532
533 #endif