OnixS C++ CME MDP Premium Market Data Handler  5.8.3
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 public:
35  /// Initializes blank instance with no valid attributes.
37  : orderId_(0)
38  , lastQty_(0)
39  {
40  }
41 
42  /// Retrieves order details from
43  /// the given market data entry.
44  template <class Entry>
45  explicit TradeOrderDetails(const Entry& entry)
46  : orderId_(entry.orderId())
47  , lastQty_(entry.lastQty())
48  {
49  }
50 
51  /// Returns the order identifier.
52  OrderId orderId() const
53  {
54  return orderId_;
55  }
56 
57  /// Returns last quantity for the
58  /// order referenced by the trade.
59  Int32 lastQty() const
60  {
61  return lastQty_;
62  }
63 
64 private:
65  OrderId orderId_;
66  Int32 lastQty_;
67 };
68 
69 /// Collection of order details referring to a single trade.
70 ///
71 /// The CME Market Data Platform sends detailed information
72 /// on the trade in addition to the trade summary. All details
73 /// on orders are gathered by the Handler during market data
74 /// processing and exposed through the appropriate callbacks.
76 {
77 public:
78  /// Alias for the trade order details.
80 
81  /// Initializes blank instance.
83 
84  /// Initializes the blank instance capacious
85  /// enough to store the given number of orders.
86  explicit TradeOrderIds(size_t capacity)
87  {
88  reserve(capacity);
89  }
90 
91  /// Initializes as a copy of the other instance.
93  : ids_(other.ids_)
94  {
95  }
96 
97  /// Destructs the internal storage.
99 
100  /// Indicates whether the collection of details is empty.
101  bool empty() const
102  {
103  return ids_.empty();
104  }
105 
106  /// The number of items in the given collection.
107  size_t size() const
108  {
109  return ids_.size();
110  }
111 
112  /// Provides access to an item by its index.
113  const Details& operator[](size_t index) const
114  {
115  assert(index < ids_.size());
116 
117  return ids_[index];
118  }
119 
120  /// Adds order details to the collection.
121  template <class Entry>
122  void add(const Entry& entry)
123  {
124  ids_.push_back(Details(entry));
125  }
126 
127  /// Resets the collection to the blank state.
128  void clear()
129  {
130  ids_.clear();
131  }
132 
133  /// Makes the collection capacious enough
134  /// to store the given number of items without
135  /// allocating additional space during insertion.
136  void reserve(size_t capacity)
137  {
138  ids_.reserve(capacity);
139  }
140 
141 private:
142  typedef std::vector<TradeOrderDetails> Ids;
143 
144  Ids ids_;
145 };
146 
Int32 Int32
int32.
Definition: Fields.h:60
void add(const Entry &entry)
Adds order details to the collection.
TradeOrderIds(size_t capacity)
Initializes the blank instance capacious enough to store the given number of orders.
Definition: TradeOrderIds.h:86
Stores information on a trade order like the order identifier and the other details.
Definition: TradeOrderIds.h:32
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
TradeOrderDetails()
Initializes blank instance with no valid attributes.
Definition: TradeOrderIds.h:36
Collection of order details referring to a single trade.
Definition: TradeOrderIds.h:75
TradeOrderDetails(const Entry &entry)
Retrieves order details from the given market data entry.
Definition: TradeOrderIds.h:45
TradeOrderIds(const TradeOrderIds &other)
Initializes as a copy of the other instance.
Definition: TradeOrderIds.h:92
TradeOrderIds()
Initializes blank instance.
Definition: TradeOrderIds.h:82
void clear()
Resets the collection to the blank state.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
size_t size() const
The number of items in the given collection.
const Details & operator[](size_t index) const
Provides access to an item by its index.
Int32 lastQty() const
Returns last quantity for the order referenced by the trade.
Definition: TradeOrderIds.h:59
bool empty() const
Indicates whether the collection of details is empty.
OrderId orderId() const
Returns the order identifier.
Definition: TradeOrderIds.h:52
TradeOrderDetails Details
Alias for the trade order details.
Definition: TradeOrderIds.h:79
void reserve(size_t capacity)
Makes the collection capacious enough to store the given number of items without allocating additiona...
UInt64 OrderId
Type for order identification.
Definition: Order.h:29
~TradeOrderIds()
Destructs the internal storage.
Definition: TradeOrderIds.h:98
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68