OnixS C++ CME Market Data Handler  5.4.0
API documentation
TradeOrderIds.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <vector>
24 
25 #include <OnixS/CME/MDH/Order.h>
26 #include <OnixS/CME/MDH/Messages.h>
27 
29 
30 /// Stores information on a trade order like
31 /// the order identifier and the other details.
33 {
34  OrderId orderId_;
35  Int32 lastQty_;
36 
37 public:
38  /// Initializes blank instance with no valid attributes.
40  : orderId_(0), lastQty_(0)
41  {
42  }
43 
44  /// Retrieves order details from
45  /// the given market data entry.
46  template
47  <
48  class Entry
49  >
50  explicit
52  const Entry& entry)
53  : orderId_(
54  entry.orderId())
55  , lastQty_(
56  entry.lastQty())
57  {
58  }
59 
60  /// Returns the order identifier.
61  OrderId orderId() const
62  {
63  return orderId_;
64  }
65 
66  /// Returns last quantity for the
67  /// order referenced by the trade.
68  Int32 lastQty() const
69  {
70  return lastQty_;
71  }
72 };
73 
74 /// Collection of order details referring to a single trade.
75 ///
76 /// The CME Market Data Platform sends detailed information
77 /// on the trade in addition to the trade summary. All details
78 /// on orders are gathered by the Handler during market data
79 /// processing and exposed through the appropriate callbacks.
81 {
82  typedef
83  std::vector<TradeOrderDetails>
84  Ids;
85 
86  Ids ids_;
87 
88 public:
89  /// Alias for the trade order details.
90  typedef
93 
94  /// Initializes blank instance.
96  {
97  }
98 
99  /// Initializes the blank instance capacious
100  /// enough to store the given number of orders.
101  explicit
103  size_t capacity)
104  {
105  reserve(capacity);
106  }
107 
108  /// Initializes as a copy of the other instance.
110  const TradeOrderIds& other)
111  : ids_(other.ids_)
112  {
113  }
114 
115  /// Destructs the internal storage.
117  {
118  }
119 
120  /// Indicates whether the collection of details is empty.
121  bool empty() const
122  {
123  return ids_.empty();
124  }
125 
126  /// The number of items in the given collection.
127  size_t size() const
128  {
129  return ids_.size();
130  }
131 
132  /// Provides access to an item by its index.
133  const
134  Details&
135  operator [](
136  size_t index) const
137  {
138  assert(
139  index <
140  ids_.size());
141 
142  return ids_[index];
143  }
144 
145  /// Adds order details to the collection.
146  template
147  <
148  class Entry
149  >
150  void
152  const Entry& entry)
153  {
154  ids_.push_back(Details(entry));
155  }
156 
157  /// Resets the collection to the blank state.
158  void clear()
159  {
160  ids_.clear();
161  }
162 
163  /// Makes the collection capacious enough
164  /// to store the given number of items without
165  /// allocating additional space during insertion.
166  void
168  size_t capacity)
169  {
170  ids_.reserve(capacity);
171  }
172 };
173 
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:94
Int32 Int32
int32.
Definition: Fields.h:69
void add(const Entry &entry)
Adds order details to the collection.
TradeOrderDetails()
Initializes blank instance with no valid attributes.
Definition: TradeOrderIds.h:39
TradeOrderDetails(const Entry &entry)
Definition: TradeOrderIds.h:51
TradeOrderIds(const TradeOrderIds &other)
Initializes as a copy of the other instance.
TradeOrderIds()
Initializes blank instance.
Definition: TradeOrderIds.h:95
void clear()
Resets the collection to the blank state.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
size_t size() const
The number of items in the given collection.
bool empty() const
Indicates whether the collection of details is empty.
OrderId orderId() const
Returns the order identifier.
Definition: TradeOrderIds.h:61
TradeOrderDetails Details
Alias for the trade order details.
Definition: TradeOrderIds.h:92
void reserve(size_t capacity)
UInt64 OrderId
Type for order identification.
Definition: Order.h:29
~TradeOrderIds()
Destructs the internal storage.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156