OnixS ICE iMpact Multicast Price Feed Handler C++ library  8.18.0
API documentation
MarketSubscription.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Onix Solutions Limited. All rights reserved.
3  *
4  * This software owned by Onix Solutions Limited and is protected by copyright law
5  * and international copyright treaties.
6  *
7  * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8  * Services Agreement (the Agreement) and Customer end user license agreements granting
9  * a non-assignable, non-transferable and non-exclusive license to use the software
10  * for it's own data processing purposes under the terms defined in the Agreement.
11  *
12  * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13  * of this source code or associated reference material to any other location for further reproduction
14  * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15  *
16  * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17  * the terms of the Agreement is a violation of copyright law.
18  */
19 
20 #pragma once
21 
22 #include "Enumerations.h"
23 #include "Export.h"
24 #include "Types.h"
25 
26 #include <iosfwd>
27 #include <set>
28 #include <string>
29 
30 namespace OnixS { namespace ICE { namespace iMpact { namespace MarketData {
31 
32 /// Defines which books should be maintained for given market type id.
33 struct ONIXS_ICEMDH_EXPORT MarketSubscription
34 {
35  /// Id of market type for which books should be maintained.
37 
38  /// Specifies type of market functionality.
39  ///
40  /// \note As a result of the increased messaging over the full implied channels,
41  /// you may experience additional latency as compared to the non-full implied channels.
42  ///
43  /// By default, all subscription is for non-implied channels.
45 
46  /// Specifies type of securities received in product definition response.
48 
49  /// Specifies book depth.
51 
52  /// Priority (to arrange product definition requests).
53  ///
54  /// By default, the priority set to zero.
55  int priority;
56 
57  /// Specifies a list of market ID's for which Handler calls callbacks.
58  /// \note If the list is empty, calls will be made for all ID's.
60 
61  /// Initializes subscription attributes for given market type id, security type and book depth.
63  MarketType marketType = static_cast<MarketType>(-1),
67  int priority = 0
68  );
69 
70  /// Deserialize from a string representation.
71  static MarketSubscription deserialize(const char*);
72 
73  /// Returns true if current instance is equal to the given.
74  bool operator==(const MarketSubscription&) const;
75 
76  /// Returns true if current instance is not equal to the given.
77  bool operator!=(const MarketSubscription&) const;
78 
79  /// Returns true if this market subscription is less than a given.
80  bool operator<(const MarketSubscription&) const;
81 
82  /// Returns string representation.
83  std::string toString() const;
84 };
85 
86 /// Allow output to C++ I/O streams.
87 ONIXS_ICEMDH_EXPORT std::ostream& operator<<(std::ostream&, const MarketSubscription&);
88 
90 {
91  if (marketType != rhs.marketType)
92  {
93  return false;
94  }
95 
96  if (marketSubType != rhs.marketSubType)
97  {
98  return false;
99  }
100 
101  if (securityType != rhs.securityType)
102  {
103  return false;
104  }
105 
106  if (bookDepth != rhs.bookDepth)
107  {
108  return false;
109  }
110 
111  if (priority != rhs.priority)
112  {
113  return false;
114  }
115 
116  if (marketIds != rhs.marketIds)
117  {
118  return false;
119  }
120 
121  return true;
122 }
123 
125 {
126  return !(*this == rhs);
127 }
128 
129 inline bool MarketSubscription::operator<(const MarketSubscription& right) const
130 {
131  if (priority < right.priority)
132  {
133  return true;
134  }
135 
136  if (priority > right.priority)
137  {
138  return false;
139  }
140 
141  if (marketType < right.marketType)
142  {
143  return true;
144  }
145 
146  if (marketType > right.marketType)
147  {
148  return false;
149  }
150 
151  if (marketSubType < right.marketSubType)
152  {
153  return true;
154  }
155 
156  if (marketSubType > right.marketSubType)
157  {
158  return false;
159  }
160 
161  if (securityType < right.securityType)
162  {
163  return true;
164  }
165 
166  if (securityType > right.securityType)
167  {
168  return false;
169  }
170 
171  if (bookDepth < right.bookDepth)
172  {
173  return true;
174  }
175 
176  if (bookDepth > right.bookDepth)
177  {
178  return false;
179  }
180 
181  if (marketIds < right.marketIds)
182  {
183  return true;
184  }
185 
186  if (marketIds > right.marketIds)
187  {
188  return false;
189  }
190 
191  return false;
192 }
193 
194 /// Collection of market subscriptions.
195 typedef std::set<MarketSubscription> MarketSubscriptions;
196 
197 }}}} // namespace OnixS::ICE::iMpact::MarketData
std::set< MarketId > MarketIds
List of market ID&#39;s.
Definition: Types.h:48
short MarketType
Alias for market types.
Definition: Types.h:36
bool operator==(const MarketSubscription &) const
Returns true if current instance is equal to the given.
bool operator!=(const MarketSubscription &) const
Returns true if current instance is not equal to the given.
Enum
Depth of order book constants.
Definition: Enumerations.h:105
std::ostream & operator<<(std::ostream &, const Error &)
Make it printable to formatted C++ I/O streams.
Declare ICE iMpact enumerations.
The enhanced implication technology is disabled.
Definition: Enumerations.h:131
Defines which books should be maintained for given market type id.
std::set< MarketSubscription > MarketSubscriptions
Collection of market subscriptions.
SecurityType::Enum securityType
Specifies type of securities received in product definition response.
MarketType marketType
Id of market type for which books should be maintained.
BookDepth::Enum bookDepth
Specifies book depth.
bool operator<(const MarketSubscription &) const
Returns true if this market subscription is less than a given.