OnixS C++ CME MDP Premium Market Data Handler 5.9.0
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
Set of listeners to be used by the Handler to reflect various aspects of market data processing.
HandlerListeners & marketData(MarketDataListener *listener)
Assigns listener for market data related events.
HandlerListeners(SettingChangeController *controller=nullptr)
Initializes listeners with default values.
MarketDataListener * marketData() const
Returns an instance of MarketDataListener to be used by the Handler while raising market data related...
SecurityListener & securityOrDefault() const
Returns an instance of SecurityListener to be used by the Handler while raising security-related even...
HandlerListeners & security(SecurityListener *listener)
Assigns listener for security related events.
HandlerListeners & handler(HandlerListener *listener)
Assigns listener for Handler related events.
ChannelFeedListener & feedsOrDefault() const
Returns an instance of ChannelFeedListener to be used by the Handler while raising feed related event...
HandlerListener * handler() const
Returns an instance of HandlerListener to be used by the Handler while raising Handler related events...
ChannelFeedListener * feeds() const
Returns an instance of ChannelFeedListener to be used by the Handler while raising feed related event...
~HandlerListeners()
Finalizes the instance.
HandlerListeners & feeds(ChannelFeedListener *listener)
Assigns listener for feed related events.
MarketDataListener & marketDataOrDefault() const
Returns an instance of MarketDataListener to be used by the Handler while raising market data related...
HandlerListeners(const HandlerListeners &other)
Re-initializes settings as copies of the other ones omitting group belonging.
SecurityListener * security() const
Returns an instance of SecurityListener to be used by the Handler while raising security-related even...
HandlerListener & handlerOrDefault() const
Returns an instance of HandlerListener to be used by the Handler while raising Handler related events...
HandlerListeners & operator=(const HandlerListeners &other)
Copies listeners from the given instance.
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
Guarded assignment of the given value to the given variable.
SettingGroup(SettingChangeController *controller=nullptr)
Initializes the group of settings with the given validation services.
void controlChange(const Char *description, void(Changeable::*change)(), Changeable &changeable) const
Guarded invoke of the given routine which assumes complex change or update for the given object.
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.
Default listeners used by the Handler if no user-defined instances are provided.
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 during market data processing to reflect various stages of processing.
Callbacks invoked by Handler to expose market data entities.
Represents a service controlling change/update operations for the collections of settings.