OnixS C++ CME MDP Premium Market Data Handler 5.9.0
Users' manual and API documentation
Loading...
Searching...
No Matches
HandlerListeners.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 <string>
24
27
30
32
34
38{
41 {
42 static HandlerListener listener;
43
44 return listener;
45 }
46
49 {
50 static ChannelFeedListener listener;
51
52 return listener;
53 }
54
57 {
58 static MarketDataListener listener;
59
60 return listener;
61 }
62
65 {
66 static SecurityListener listener;
67
68 return listener;
69 }
70};
71
75{
76public:
79 : SettingGroup(controller)
80 , handler_(&DefaultListeners::handler())
81 , feeds_(&DefaultListeners::feeds())
82 , marketData_(&DefaultListeners::marketData())
83 , security_(&DefaultListeners::security())
84 {
85 }
86
90 : SettingGroup()
91 , handler_(other.handler_)
92 , feeds_(other.feeds_)
93 , marketData_(other.marketData_)
94 , security_(other.security_)
95 {
96 }
97
100
104 {
105 return (handler_ != &DefaultListeners::handler() ? handler_ : ONIXS_CMEMDH_NULLPTR);
106 }
107
114 {
115 return *handler_;
116 }
117
123 {
124 controlAssignment("Handler Listener", handler_, listener ? listener : &DefaultListeners::handler());
125
126 return *this;
127 }
128
132 {
133 return (feeds_ != &DefaultListeners::feeds() ? feeds_ : ONIXS_CMEMDH_NULLPTR);
134 }
135
142 {
143 return *feeds_;
144 }
145
151 {
152 controlAssignment("ChannelFeed Listener", feeds_, listener ? listener : &DefaultListeners::feeds());
153
154 return *this;
155 }
156
160 {
161 return (marketData_ != &DefaultListeners::marketData() ? marketData_ : ONIXS_CMEMDH_NULLPTR);
162 }
163
170 {
171 return *marketData_;
172 }
173
179 {
180 controlAssignment("MarketData Listener", marketData_, listener ? listener : &DefaultListeners::marketData());
181
182 return *this;
183 }
184
188 {
189 return (security_ != &DefaultListeners::security() ? security_ : ONIXS_CMEMDH_NULLPTR);
190 }
191
198 {
199 return *security_;
200 }
201
207 {
208 controlAssignment("Security Listener", security_, listener ? listener : &DefaultListeners::security());
209
210 return *this;
211 }
212
218 {
219 controlChange("Handler Listeners", &HandlerListeners::assignNoControl, *this, other);
220
221 return *this;
222 }
223
224private:
225 // Lets grouping and value assignment control functioning.
227
228 //
229
230 HandlerListener* handler_;
231 ChannelFeedListener* feeds_;
232 MarketDataListener* marketData_;
233 SecurityListener* security_;
234
235 // Re-initializes the instance as a copy of the
236 // other one and bypassing assignment control.
237 void assignNoControl(const HandlerListeners& other)
238 {
239 handler_ = other.handler_;
240 feeds_ = other.feeds_;
241
242 marketData_ = other.marketData_;
243 security_ = other.security_;
244 }
245};
246
249void toStr(std::string&, const HandlerListeners&);
250
252inline std::string toStr(const HandlerListeners& listeners)
253{
254 std::string str;
255
256 toStr(str, listeners);
257
258 return str;
259}
260
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:48
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_NULLPTR
Definition Compiler.h:178
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
HandlerListeners & marketData(MarketDataListener *listener)
HandlerListeners(SettingChangeController *controller=nullptr)
Initializes listeners with default values.
MarketDataListener * marketData() const
SecurityListener & securityOrDefault() const
HandlerListeners & security(SecurityListener *listener)
HandlerListeners & handler(HandlerListener *listener)
ChannelFeedListener & feedsOrDefault() const
HandlerListener * handler() const
ChannelFeedListener * feeds() const
~HandlerListeners()
Finalizes the instance.
HandlerListeners & feeds(ChannelFeedListener *listener)
MarketDataListener & marketDataOrDefault() const
HandlerListeners(const HandlerListeners &other)
SecurityListener * security() const
HandlerListener & handlerOrDefault() const
HandlerListeners & operator=(const HandlerListeners &other)
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
SettingGroup(SettingChangeController *controller=nullptr)
void controlChange(const Char *description, void(Changeable::*change)(), Changeable &changeable) const
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
A listener for the feed-related events in the bounds of a single Handler instance.
static HandlerListener & handler()
Default listener for Handler-related events.
static MarketDataListener & marketData()
Default listener for market data -related events.
static SecurityListener & security()
Default listener for security-related events.
static ChannelFeedListener & feeds()
Default listener for feed-related events.
Events raised by Handler while processing market data.
Callbacks invoked by Handler to expose market data entities.