OnixS C++ CME Streamlined Market Data Handler  1.0.0.4
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 
33 
36 
38 
40 
43 
44 ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS_DECL(InstrumentSelection);
45 
47 
48 /// Encapsulates all the machinery related with market
49 /// data processing from CME Market Data Platform.
51 {
52  // Data processing workhorse.
53  ChannelModel* model_;
54 
55 public:
56  /// Initializes instance according to given settings.
57  Handler(
58  const HandlerSettings&);
59 
60  /// Finalizes instance usage.
61  ~Handler();
62 
63  /// Configuration settings of given instance.
64  const HandlerSettings& settings() const;
65 
66  /// Logger currently used by the Handler.
67  Logger& logger();
68 
69  /// Filters instruments whose market data
70  /// is to be processed and events are to be
71  /// fired by the Handler.
72  ///
73  /// @warning Instrument selection can be updated
74  /// only when market data processing is not performed
75  /// by the Handler or upon successful instrument
76  /// recovery completion.
77  void
78  selectInstruments(
79  const InstrumentSelection&);
80 
81  /// Registers Handler events listener.
82  ///
83  /// Only single instance of listener can be associated with
84  /// the Handler. Registering new listener removes previous one.
85  /// Listener instance lifetime shall be not less than Handler's one.
86  ///
87  /// Listeners are to be associated before starting market data
88  /// processing - Handler must be in stopped state.
89  ///
90  /// @throw std::exception in case when handler is not in configurable state.
91  void
92  registerListener(
93  HandlerListener& listener);
94 
95  /// Registers feed event listener.
96  ///
97  /// Only single instance of listener can be associated with
98  /// the Handler. Registering new listener removes previous one.
99  /// Listener instance lifetime shall be not less than Handler's one.
100  ///
101  /// Listeners are to be associated before starting market data
102  /// processing - Handler must be in stopped state.
103  ///
104  /// @throw std::exception in case when handler is not in configurable state.
105  void
106  registerFeedListener(
107  FeedListener& listener);
108 
109  /// Registers market data processing listener.
110  ///
111  /// Only single instance of listener can be associated with
112  /// the Handler. Registering new listener removes previous one.
113  /// Listener instance lifetime shall be not less than Handler's one.
114  ///
115  /// Listeners are to be associated before starting market data
116  /// processing - Handler must be in stopped state.
117  ///
118  /// @throw std::exception in case when handler is not in configurable state.
119  void
120  registerMarketDataListener(
121  MarketDataListener& listener);
122 
123  /// Binds Feed Engine to the Handler.
124  ///
125  /// Handler must be in stopped state.
126  ///
127  /// @throw std::exception in case when handler is not in configurable state.
128  void
129  bindFeedEngine(
130  FeedEngine& feedEngine);
131 
132  /// Binds TCP Recovery Service to the Handler.
133  ///
134  /// Handler must be in stopped state.
135  ///
136  /// @throw std::exception in case when handler is not in configurable state.
137  void
138  bindTcpRecovery(
139  TcpRecoveryService& tcpRecovery);
140 
141  /// Binds Logging Service to the Handler.
142  ///
143  /// Handler must be in stopped state.
144  ///
145  /// @throw std::exception in case when handler is not in configurable state.
146  void
147  bindLogger(
148  Logger& logger);
149 
150  /// Erases instrument definitions cache if used.
151  /// Handler will produce a new cache at next start.
152  void clearInstrumentCache();
153 
154  /// Starts market data processing according to given parameters.
155  void
156  start(
157  const SessionSettings&);
158 
159  /// Stops the Handler.
160  void stop();
161 
162  /// Processes market data stored in log
163  /// files according to specified settings.
164  void
165  replay(
166  const ReplaySettings&);
167 };
168 
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_STRUCT_DECL(typeName)
Definition: Bootstrap.h:58
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:54
Defines parameters which affect logs replay.
Definition: Replay.h:72
Handler&#39;s configuration settings.
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:366
Listener for feed-related events.
Definition: FeedListener.h:38
Events raised by Handler while processing market data.
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition: Bootstrap.h:172
#define ONIXS_CMESTREAMLINEDMDH_INTERNAL_CLASS_DECL(typeName)
Definition: Bootstrap.h:70
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_CLASS
Definition: Bootstrap.h:62
#define ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:122
Abstraction of logger.
Definition: Logger.h:179
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168