OnixS ICE iMpact Multicast Price Feed Handler C++ library  8.15.1
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 "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 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/) 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  return false;
83 
84  if (marketSubType != rhs.marketSubType)
85  return false;
86 
87  if (bookDepth != rhs.bookDepth)
88  return false;
89 
90  if (marketIds != rhs.marketIds)
91  return false;
92 
93  return true;
94 }
95 
96 inline bool GroupSubscription::operator!=(const GroupSubscription& rhs) const
97 {
98  return !(*this == rhs);
99 }
100 
101 inline bool GroupSubscription::operator<(const GroupSubscription& right) const
102 {
103  if (groupName < right.groupName)
104  return true;
105 
106  if (groupName > right.groupName)
107  return false;
108 
109  if (marketSubType < right.marketSubType)
110  return true;
111 
112  if (marketSubType > right.marketSubType)
113  return false;
114 
115  if (bookDepth < right.bookDepth)
116  return true;
117 
118  if (bookDepth > right.bookDepth)
119  return false;
120 
121  if (marketIds < right.marketIds)
122  return true;
123 
124  if (marketIds > right.marketIds)
125  return false;
126 
127  return false;
128 }
129 
130 /// Collection of group subscriptions.
131 typedef std::set<GroupSubscription> GroupSubscriptions;
132 
133 }}}} // namespace MarketData, iMpact, ICE, OnixS
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.