OnixS ICE iMpact Multicast Price Feed Handler C++ library  8.10.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 "Export.h"
23 #include "Types.h"
24 #include "Enumerations.h"
25 
26 #include <iosfwd>
27 #include <string>
28 #include <set>
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 arrarange 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/) streams.
87 ONIXS_ICEMDH_EXPORT std::ostream& operator<<(std::ostream&, const MarketSubscription&);
88 
90 {
91  if (marketType != rhs.marketType)
92  return false;
93 
94  if (marketSubType != rhs.marketSubType)
95  return false;
96 
97  if (securityType != rhs.securityType)
98  return false;
99 
100  if (bookDepth != rhs.bookDepth)
101  return false;
102 
103  if (priority != rhs.priority)
104  return false;
105 
106  if (marketIds != rhs.marketIds)
107  return false;
108 
109  return true;
110 }
111 
113 {
114  return !(*this == rhs);
115 }
116 
117 inline bool MarketSubscription::operator<(const MarketSubscription& right) const
118 {
119  if (priority < right.priority)
120  return true;
121 
122  if (priority > right.priority)
123  return false;
124 
125  if (marketType < right.marketType)
126  return true;
127 
128  if (marketType > right.marketType)
129  return false;
130 
131  if (marketSubType < right.marketSubType)
132  return true;
133 
134  if (marketSubType > right.marketSubType)
135  return false;
136 
137  if (securityType < right.securityType)
138  return true;
139 
140  if (securityType > right.securityType)
141  return false;
142 
143  if (bookDepth < right.bookDepth)
144  return true;
145 
146  if (bookDepth > right.bookDepth)
147  return false;
148 
149  if (marketIds < right.marketIds)
150  return true;
151 
152  if (marketIds > right.marketIds)
153  return false;
154 
155  return false;
156 }
157 
158 /// Collection of market subscriptions.
159 typedef std::set<MarketSubscription> MarketSubscriptions;
160 
161 }}}} // namespace MarketData, iMpact, ICE, OnixS
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.