libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
messages_impl.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright © 2016 by J.M.McGuiness, isimud@hussar.me.uk
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Lesser General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2.1 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public
15 ** License along with this library; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
19 namespace isimud { namespace ISIMUD_VER_NAMESPACE { namespace exchanges { namespace MIT { namespace JSE {
20 
21 inline constexpr
23 : Header_t(static_cast<TransmissionComplete const *>(nullptr)), status(s) {}
24 
25 inline constexpr
26 Logon::Logon(const logon_args_t::UserName_t &UN, const logon_args_t::Password_t &P, const logon_args_t::Password_t &NP) noexcept(true)
27 : Header_t(static_cast<Logon const *>(nullptr)), userName(UN), password(P), newPassword(NP) {
28 }
29 
30 inline constexpr
31 Logon::Logon(logon_args_t const &a) noexcept(true)
33 }
34 
35 inline
37 : Header_t(static_cast<LogonResponse const *>(nullptr)) {}
38 
40  template<class ReplyMsg, class Op> void
41  operator()(ReplyMsg const &msg, Op const &o) const noexcept(false) FORCE_INLINE {
42  switch (msg.rejectCode()) {
43  case ReplyMsg::logon_success:
44  o.operator()();
45  break;
46  default: {
47  std::ostringstream os;
48  os<<"Failed to logon. Reject code="<<msg.rejectCode();
49  assert(!"TODO need reject code as string.");
50  throw std::runtime_error(os.str());
51  }
52  }
53  }
54 };
55 
56 inline constexpr
57 NewOrder::NewOrder(std::int32_t, common::ClientOrderID_t const &clID, common::OrderType const oT, common::TIF const t, common::Side const s, common::SecurityID_t instID, order_qty_t ordQty, common::Price_t p) noexcept(true)
58 : Header_t(static_cast<NewOrder const *>(nullptr)),
60  instrumentID_(instID),
61  orderType_(oT),
62  tif_(t),
63  side_(s),
64  orderQty_(ordQty),
65  limitPrice_(p) {
66 }
67 
68 inline
69 OrderCancelReplaceRequest::OrderCancelReplaceRequest(common::ClientOrderID_t const &clID, common::ClientOrderID_t const &origclID, common::SecurityID_t instID, order_qty_t ordQty, common::Price_t const p, common::TIF t, common::Side s) noexcept(true)
70 : Header_t(static_cast<OrderCancelReplaceRequest const *>(nullptr)),
71  instrumentID_(instID),
72  tif_(t),
73  side_(s),
74  orderQty_(ordQty),
75  limitPrice_(p) {
76  libjmmcg::memcpy_opt(clID, clientOrderID_);
77  libjmmcg::memcpy_opt(origclID, originalClientOrderID_);
78 }
79 
80 inline constexpr
81 NewOrderCross::NewOrderCross(common::ClientOrderID_t const &origclID, common::SecurityID_t instID, order_qty_t ordQty, common::Price_t const p, common::TIF t) noexcept(true)
82 : Header_t(static_cast<NewOrderCross const *>(nullptr)),
84  instrumentID_(instID),
85  tif_(t),
86  limitPrice_(p),
87  orderQty_(ordQty) {
88 }
89 
90 inline
92 : Header_t(static_cast<ExecutionReport const *>(nullptr)) {
93 }
94 
95 inline constexpr
96 ExecutionReport::ExecutionReport(std::int32_t seqNum, common::ClientOrderID_t const &clID, common::AppID aID, common::ExecType eT, common::Price_t const price, common::SecurityID_t instID, common::Side s) noexcept(true)
97 : Header_t(static_cast<ExecutionReport const *>(nullptr)),
98  partitionID(aID),
99  sequenceNumber(seqNum),
101  execType_(eT),
102  executedPrice_(price),
103  instrumentID_(instID),
104  side_(s) {
105 }
106 
107 } } } } }