OnixS C++ CME Market Data Handler  5.4.0
API documentation
Handler.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 #include <memory>
25 
27 
29 
30 ONIXS_CMEMDH_LTWT_CLASS_DECL(HandlerSettings);
31 ONIXS_CMEMDH_LTWT_CLASS_DECL(MemoryPoolSettings);
32 ONIXS_CMEMDH_LTWT_CLASS_DECL(InstrumentSelection);
33 
34 #if !defined (ONIXS_CMEMDH_NO_DEPRECATED)
35 
36 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(HandlerListener);
37 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(ChannelFeedListener);
38 
39 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(MarketDataListener);
40 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(SecurityListener);
41 
44 ONIXS_CMEMDH_EXPORTED_CLASS_DECL(TcpRecoveryService);
45 
46 ONIXS_CMEMDH_LTWT_CLASS_DECL(SessionSettings);
47 ONIXS_CMEMDH_LTWT_CLASS_DECL(ReplaySettings);
48 
49 #endif // ONIXS_CMEMDH_NO_DEPRECATED
50 
52 
53 /// Encapsulates all the machinery related with market
54 /// data processing from CME Market Data Platform.
56 {
57  // Data processing workhorse.
58  ChannelModel* model_;
59 
60  // Coping is not allowed for the instances.
61 
62  Handler(const Handler&);
63  Handler& operator =(const Handler&);
64 
65 public:
66  /// Initializes the instance with the default settings.
67  Handler();
68 
69  /// Initializes instance with the memory pool
70  /// configured according to the given settings.
71  Handler(
72  const
74 
75 #if !defined (ONIXS_CMEMDH_NO_DEPRECATED)
76 
77  /// Initializes the instance
78  /// according to the given settings.
79  ///
80  /// @warning The given member is deprecated.
81  /// The Handler configuration can be updated
82  /// any time through the settings() member when
83  /// the Handler does not process market data.
84  Handler(
85  const HandlerSettings&);
86 
87 #endif // ONIXS_CMEMDH_NO_DEPRECATED
88 
89  /// Finalizes the instance.
90  ~Handler();
91 
92  /// The configuration parameters of the given instance.
93  HandlerSettings& settings();
94 
95  /// Immutable configuration of the given instance.
96  const HandlerSettings& settings() const;
97 
98 #if !defined (ONIXS_CMEMDH_NO_DEPRECATED)
99 
100  /// Logger currently used by the Handler.
101  ///
102  /// @warning The given member is deprecated.
103  /// Use settings().logging().logger() member
104  /// to access the Logger instance used by the
105  /// Handler while logging its events.
106  Logger& logger();
107 
108 #endif // ONIXS_CMEMDH_NO_DEPRECATED
109 
110  /// Filters instruments whose market data
111  /// is to be processed and events are to be
112  /// fired by the Handler.
113  ///
114  /// @warning Instrument selection can be
115  /// updated only when market data processing
116  /// is not performed by the Handler or upon
117  /// successful instrument recovery completion.
118  void
119  selectInstruments(
120  const InstrumentSelection&);
121 
122  /// Erases instrument definitions cache if used.
123  /// Handler will produce a new cache at next start.
124  void clearInstrumentCache();
125 
126 #if !defined (ONIXS_CMEMDH_NO_DEPRECATED)
127 
128  /// Registers Handler events listener.
129  ///
130  /// Only single instance of listener can be
131  /// associated with the Handler. Registering
132  /// new listener removes previous one. Listener
133  /// instance lifetime shall be not less than
134  /// Handler's one.
135  ///
136  /// Listeners are to be associated before
137  /// starting market data processing - Handler
138  /// must be in stopped state.
139  ///
140  /// @throw std::exception in case when
141  /// handler is not in configurable state.
142  ///
143  /// @warning The given member is deprecated.
144  /// Use settings().listeners().handler() member
145  /// to assign the listener for the desired events.
146  void
147  registerListener(
148  HandlerListener& listener);
149 
150  /// Registers feed event listener.
151  ///
152  /// Only single instance of listener can be
153  /// associated with the Handler. Registering
154  /// new listener removes previous one. Listener
155  /// instance lifetime shall be not less than
156  /// Handler's one.
157  ///
158  /// Listeners are to be associated before
159  /// starting market data processing - Handler
160  /// must be in stopped state.
161  ///
162  /// @throw std::exception in case when
163  /// handler is not in configurable state.
164  ///
165  /// @warning The given member is deprecated.
166  /// Use settings().listeners().feeds() member
167  /// to assign the listener for the desired events.
168  void
169  registerFeedListener(
170  ChannelFeedListener& listener);
171 
172  /// Registers market data processing listener.
173  ///
174  /// Only single instance of listener can be
175  /// associated with the Handler. Registering
176  /// new listener removes previous one. Listener
177  /// instance lifetime shall be not less than
178  /// Handler's one.
179  ///
180  /// Listeners are to be associated before
181  /// starting market data processing - Handler
182  /// must be in stopped state.
183  ///
184  /// @throw std::exception in case when
185  /// handler is not in configurable state.
186  ///
187  /// @warning The given member is deprecated.
188  /// Use settings().listeners().marketData() member
189  /// to assign the listener for the desired events.
190  void
191  registerMarketDataListener(
192  MarketDataListener& listener);
193 
194  /// Registers security events listener.
195  ///
196  /// Only single instance of listener can be
197  /// associated with the Handler. Registering
198  /// new listener removes previous one. Listener
199  /// instance lifetime shall be not less than
200  /// Handler's one.
201  ///
202  /// Listeners are to be associated before
203  /// starting market data processing - Handler
204  /// must be in stopped state.
205  ///
206  /// @throw std::exception in case when
207  /// handler is not in configurable state.
208  ///
209  /// @warning The given member is deprecated.
210  /// Use settings().listeners().security() member
211  /// to assign the listener for the desired events.
212  void
213  registerSecurityListener(
214  SecurityListener& listener);
215 
216  /// Binds Feed Engine to the Handler.
217  ///
218  /// Handler must be in stopped state.
219  ///
220  /// @throw std::exception in case when
221  /// handler is not in configurable state.
222  ///
223  /// @warning The given member is deprecated.
224  /// Use settings().feeds().engine() member to
225  /// assign the feed engine used by the Handler
226  /// while manipulating the feeds.
227  void
228  bindFeedEngine(
229  NetFeedEngine& feedEngine);
230 
231  /// Binds TCP Recovery Service to the Handler.
232  ///
233  /// Handler must be in stopped state.
234  ///
235  /// @throw std::exception in case when
236  /// handler is not in configurable state.
237  ///
238  /// @warning The given member is deprecated.
239  /// Use settings().session().tcpRecovery().service()
240  /// member to assign the TCP recovery service used by
241  /// the Handler to request missing packets.
242  void
243  bindTcpRecovery(
244  TcpRecoveryService& tcpRecovery);
245 
246  /// Binds Logging Service to the Handler.
247  ///
248  /// Handler must be in stopped state.
249  ///
250  /// @throw std::exception in case when
251  /// handler is not in configurable state.
252  ///
253  /// @warning The given member is deprecated.
254  /// Use settings().logging().logger() member
255  /// to assign the Logger instance used by the
256  /// Handler to log various events.
257  void
258  bindLogger(
259  Logger& logger);
260 
261 #endif // ONIXS_CMEMDH_NO_DEPRECATED
262 
263  /// Starts market data processing.
264  void start();
265 
266 #if !defined (ONIXS_CMEMDH_NO_DEPRECATED)
267 
268  /// Updates the session configuration
269  /// according to the given settings and
270  /// starts market data processing.
271  ///
272  /// @warning The given member is deprecated.
273  /// Use settings().session() member to update
274  /// session-related configuration and start()
275  /// member to launch market data processing.
276  void
277  start(
278  const SessionSettings&);
279 
280 #endif // ONIXS_CMEMDH_NO_DEPRECATED
281 
282  /// Stops market data processing.
283  void stop();
284 };
285 
Handler&#39;s configuration settings.
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:46
Callbacks invoked by Handler to expose market data entities.
#define ONIXS_CMEMDH_EXPORTED_CLASS
Definition: Bootstrap.h:54
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
#define ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(typeName)
Definition: Bootstrap.h:50
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:106
Abstraction of logger.
Definition: Logger.h:179
#define ONIXS_CMEMDH_INTERNAL_CLASS_DECL(typeName)
Definition: Bootstrap.h:62
Events raised by Handler while processing market data.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156