OnixS ICE iMpact Multicast Price Feed Handler C++ library  8.18.0
API documentation
GroupSubscription.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 group name.
33 struct ONIXS_ICEMDH_EXPORT GroupSubscription
34 {
35  /// Multicast group name.
36  std::string groupName;
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 book depth.
48 
49  /// Specifies a list of market ID's for which Handler calls callbacks.
50  /// \note If the list is empty, calls will be made for all ID's.
52 
53  /// Initializes group subscription attributes.
55  const std::string& groupName,
58  );
59 
60  /// Deserialize from a string representation.
61  static GroupSubscription deserialize(const std::string&);
62 
63  /// Returns true if current instance is equal to the given.
64  bool operator==(const GroupSubscription&) const;
65 
66  /// Returns true if current instance is not equal to the given.
67  bool operator!=(const GroupSubscription&) const;
68 
69  /// Returns true if this market subscription is less than a given.
70  bool operator<(const GroupSubscription&) const;
71 
72  /// Returns string representation.
73  std::string toString() const;
74 };
75 
76 /// Allow output to C++ I/O streams.
77 ONIXS_ICEMDH_EXPORT std::ostream& operator<<(std::ostream&, const GroupSubscription&);
78 
79 inline bool GroupSubscription::operator==(const GroupSubscription& rhs) const
80 {
81  if (groupName != rhs.groupName)
82  {
83  return false;
84  }
85 
86  if (marketSubType != rhs.marketSubType)
87  {
88  return false;
89  }
90 
91  if (bookDepth != rhs.bookDepth)
92  {
93  return false;
94  }
95 
96  if (marketIds != rhs.marketIds)
97  {
98  return false;
99  }
100 
101  return true;
102 }
103 
105 {
106  return !(*this == rhs);
107 }
108 
109 inline bool GroupSubscription::operator<(const GroupSubscription& right) const
110 {
111  if (groupName < right.groupName)
112  {
113  return true;
114  }
115 
116  if (groupName > right.groupName)
117  {
118  return false;
119  }
120 
121  if (marketSubType < right.marketSubType)
122  {
123  return true;
124  }
125 
126  if (marketSubType > right.marketSubType)
127  {
128  return false;
129  }
130 
131  if (bookDepth < right.bookDepth)
132  {
133  return true;
134  }
135 
136  if (bookDepth > right.bookDepth)
137  {
138  return false;
139  }
140 
141  if (marketIds < right.marketIds)
142  {
143  return true;
144  }
145 
146  if (marketIds > right.marketIds)
147  {
148  return false;
149  }
150 
151  return false;
152 }
153 
154 /// Collection of group subscriptions.
155 typedef std::set<GroupSubscription> GroupSubscriptions;
156 
157 }}}} // namespace OnixS::ICE::iMpact::MarketData
bool operator<(const GroupSubscription &) const
Returns true if this market subscription is less than a given.
std::set< MarketId > MarketIds
List of market ID&#39;s.
Definition: Types.h:48
Enum
Depth of order book constants.
Definition: Enumerations.h:105
std::set< GroupSubscription > GroupSubscriptions
Collection of group subscriptions.
std::ostream & operator<<(std::ostream &, const Error &)
Make it printable to formatted C++ I/O streams.
Declare ICE iMpact enumerations.
bool operator==(const GroupSubscription &) const
Returns true if current instance is equal to the given.
The enhanced implication technology is disabled.
Definition: Enumerations.h:131
std::string groupName
Multicast group name.
bool operator!=(const GroupSubscription &) const
Returns true if current instance is not equal to the given.
Defines which books should be maintained for given group name.
BookDepth::Enum bookDepth
Specifies book depth.