OnixS C++ CME MDP Premium Market Data Handler 5.11.1
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
78{
79public:
82 : SettingGroup(controller)
83 , handler_(&DefaultListeners::handler())
84 , feeds_(&DefaultListeners::feeds())
85 , marketData_(&DefaultListeners::marketData())
86 , security_(&DefaultListeners::security())
87 {
88 }
89
93 : SettingGroup()
94 , handler_(other.handler_)
95 , feeds_(other.feeds_)
96 , marketData_(other.marketData_)
97 , security_(other.security_)
98 {
99 }
100
103
107 {
108 return (handler_ != &DefaultListeners::handler() ? handler_ : nullptr);
109 }
110
117 {
118 return *handler_;
119 }
120
128 {
129 controlAssignment("Handler Listener", handler_, listener ? listener : &DefaultListeners::handler());
130
131 return *this;
132 }
133
137 {
138 return (feeds_ != &DefaultListeners::feeds() ? feeds_ : nullptr);
139 }
140
147 {
148 return *feeds_;
149 }
150
158 {
159 controlAssignment("ChannelFeed Listener", feeds_, listener ? listener : &DefaultListeners::feeds());
160
161 return *this;
162 }
163
167 {
168 return (marketData_ != &DefaultListeners::marketData() ? marketData_ : nullptr);
169 }
170
177 {
178 return *marketData_;
179 }
180
188 {
189 controlAssignment("MarketData Listener", marketData_, listener ? listener : &DefaultListeners::marketData());
190
191 return *this;
192 }
193
197 {
198 return (security_ != &DefaultListeners::security() ? security_ : nullptr);
199 }
200
207 {
208 return *security_;
209 }
210
218 {
219 controlAssignment("Security Listener", security_, listener ? listener : &DefaultListeners::security());
220
221 return *this;
222 }
223
231 {
232 controlChange("Handler Listeners", &HandlerListeners::assignNoControl, *this, other);
233
234 return *this;
235 }
236
237private:
238 // Lets grouping and value assignment control functioning.
240
241 //
242
243 HandlerListener* handler_;
244 ChannelFeedListener* feeds_;
245 MarketDataListener* marketData_;
246 SecurityListener* security_;
247
248 // Re-initializes the instance as a copy of the
249 // other one and bypassing assignment control.
250 void assignNoControl(const HandlerListeners& other)
251 {
252 handler_ = other.handler_;
253 feeds_ = other.feeds_;
254
255 marketData_ = other.marketData_;
256 security_ = other.security_;
257 }
258};
259
262void toStr(std::string&, const HandlerListeners&);
263
265inline std::string toStr(const HandlerListeners& listeners)
266{
267 std::string str;
268
269 toStr(str, listeners);
270
271 return str;
272}
273
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:69
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:61
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:63
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:73
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:163
Associates application-owned listeners with a Handler.
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)
SettingGroup(SettingChangeController *controller=nullptr)
Creates a setting group that uses the specified controller.
void controlChange(const Messaging::Char *description, void(Changeable::*change)(), Changeable &changeable) const
Invokes a zero-argument member function as a guarded change.
void controlAssignment(const Messaging::Char *description, Assignee &assignee, Value value) const
Assigns a value while coordinating the change with the controller.
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
Receives network feed events raised by 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.
Coordinates changes to settings that belong to a setting group.