OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
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 <cassert>
24#include <cstddef>
25#include <vector>
26
28#include <OnixS/CME/MDH/Order.h>
30
32
35{
36public:
38 TradeOrderDetails() noexcept = default;
39
44 template <class Entry>
45 explicit TradeOrderDetails(const Entry& entry)
46 : orderId_(entry.orderId())
47 , lastQty_(entry.lastQty())
48 {
49 }
50
55 : orderId_(orderId)
56 , lastQty_(lastQty)
57 {
58 }
59
63 OrderId orderId() const noexcept
64 {
65 return orderId_;
66 }
67
71 Messaging::Int32 lastQty() const noexcept
72 {
73 return lastQty_;
74 }
75
76private:
77 OrderId orderId_{0};
78 Messaging::Int32 lastQty_{0};
79};
80
88{
89public:
92
94 TradeOrderIds() noexcept = default;
95
100 explicit TradeOrderIds(std::size_t capacity)
101 {
102 reserve(capacity);
103 }
104
108 bool empty() const noexcept
109 {
110 return ids_.empty();
111 }
112
116 std::size_t size() const noexcept
117 {
118 return ids_.size();
119 }
120
127 const Details& operator[](std::size_t index) const noexcept
128 {
129 assert(index < ids_.size());
130
131 return ids_[index];
132 }
133
139 template <class Entry>
140 void add(const Entry& entry)
141 {
142 ids_.emplace_back(entry.orderId(), entry.lastQty());
143 }
144
146 void clear() noexcept
147 {
148 ids_.clear();
149 }
150
155 void reserve(std::size_t capacity)
156 {
157 ids_.reserve(capacity);
158 }
159
160private:
161 using Ids = std::vector<TradeOrderDetails>;
162
163 Ids ids_;
164};
165
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:69
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:61
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:73
#define ONIXS_CMEMDH_NODISCARD
Definition Compiler.h:165
Identifies an order involved in a trade and records its executed quantity.
TradeOrderDetails(OrderId orderId, Messaging::Int32 lastQty) noexcept
Constructs details with the specified order identifier and executed quantity.
OrderId orderId() const noexcept
Gets the identifier of the order involved in the trade.
Messaging::Int32 lastQty() const noexcept
Gets the quantity executed for the order by the trade.
TradeOrderDetails() noexcept=default
Constructs details with a zero order identifier and quantity.
void clear() noexcept
Removes all order details while retaining the allocated storage.
void add(const Entry &entry)
Appends order details obtained from a market data entry.
TradeOrderIds() noexcept=default
Constructs an empty collection without reserving storage.
TradeOrderDetails Details
Type used to describe each order involved in the trade.
const Details & operator[](std::size_t index) const noexcept
Accesses order details without runtime bounds checking.
bool empty() const noexcept
Checks whether the collection contains no order details.
std::size_t size() const noexcept
Gets the number of order details in the collection.
void reserve(std::size_t capacity)
Reserves storage for at least the specified number of order details.
std::int32_t Int32
int32.
Definition Integral.h:34
Messaging::UInt64 OrderId
Identifies an order in a Market By Order book.
Definition Order.h:32
STL namespace.