OnixS C++ Cboe CFE Multicast PITCH Market Data Handler  1.12.1
API documentation
Handler.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
22 #include <vector>
23 
27 
28 namespace OnixS
29 {
30  namespace CboeCFE
31  {
32  namespace MarketData
33  {
34  namespace Pitch
35  {
36  namespace Implementation { struct PcapPeplayHelper; }
37 
38  class ErrorListener;
39  class FeedEngine;
40  class WarningListener;
41  class MessageListener;
42  class OrderBookListener;
43  class ProtocolListener;
46 
47  struct HandlerSettings;
48  struct ReplayOptions;
49 
50  /// Cboe CFE Multicast PITCH Market Data Handler class.
51  class ONIXS_CBOECFE_PITCH_API Handler
52  {
53  public:
54  /// Performs instance initialization.
55  /// @param settings defines values for various options
56  /// which affect handler behavior like enabling logging
57  /// during execution of the handler.
58  explicit
59  Handler (const HandlerSettings& settings);
60 
61  /// Finalizes the Handler.
62  virtual ~Handler();
63 
64  /// Assigns listener for errors occurred while executing handler.
65  /// It's permissible to change the listener multiple times during
66  /// handler's life-time, but only when handler is in disconnected state.
67  /// @throw OperationException if handler not disconnected
68  void registerErrorListener (ErrorListener* listener);
69 
70  /// Assigns listener for warnings occurred while executing handler.
71  /// It's permissible to change the listener multiple times during
72  /// handler's life-time, but only when handler is in disconnected state.
73  /// @throw OperationException if handler not disconnected
74  void registerWarningListener (WarningListener* listener);
75 
76  /// Assigns listener for state change events occurred while executing handler.
77  /// It's permissible to change the listener multiple times during
78  /// handler's life-time, but only when handler is in disconnected state.
79  /// @throw OperationException if handler not disconnected.
80  void registerHandlerStateListener (HandlerStateListener* listener);
81 
82  /// Assigns listener to receive notification when Pitch messages is received while executing handler.
83  /// It's permissible to change the listener multiple times during
84  /// handler's life-time, but only when handler is in disconnected state.
85  /// @throw OperationException if handler not disconnected.
86  void registerMessageListener (MessageListener* listener);
87 
88  /// Assigns listener to receive notifications about message processing while executing handler.
89  /// It's permissible to change the listener multiple times during
90  /// handler's life-time, but only when handler is in disconnected state.
91  /// @throw OperationException if handler not disconnected.
92  void registerProtocolListener (ProtocolListener* listener);
93 
94  /// Assigns listener to receive notification about order book states while executing handler.
95  /// It's permissible to change the listener multiple times during
96  /// handler's life-time, but only when handler is in disconnected state.
97  /// @throw OperationException if handler not disconnected.
98  void registerOrderBookListener (OrderBookListener* listener);
99 
100  /// Assigns listener to receive notification about price level updates
101  /// It's permissible to change the listener multiple times during
102  /// handler's life-time, but only when handler is in disconnected state.
103  /// @throw OperationException if handler not disconnected.
104  void registerMarketByPriceListener (MarketByPriceListener* listener);
105 
106 
107  /// Assigns listener to receive notification additionally generated events
108  /// It's permissible to change the listener multiple times during
109  /// handler's life-time, but only when handler is in disconnected state.
110  /// @throw OperationException if handler not disconnected.
111  void registerTradeOnOrderExecutedListener (TradeOnOrderExecutedListener* listener);
112 
113 
114  /// Binds Feed Engine to the Handler.
115  ///
116  /// Handler must be in stopped state.
117  ///
118  /// @throw OperationException in case when handler is not in configurable state.
119  void bindFeedEngine(FeedEngine& feedEngine);
120 
121  /// Start handler.
122  ///
123  /// @note This action is asynchronous.
124  /// @throw std::exception in case of unable to start.
125  void start ();
126 
127  /// Starts replaying previously logged data.
128  void start (const ReplayOptions& options);
129 
130  /// Stop handler.
131  void stop (bool wait);
132 
133  /// Returns handler state.
134  HandlerState::Enum state () const;
135 
136  /// Logs the given user-level message to the handler log.
137  void log (LogLevel::Enum logLevel, const char* logMessage, size_t length);
138 
139  /// Logs the given user-level message to the handler log
140  void log (LogLevel::Enum logLevel, const char* logMessage);
141 
142  /// Logs the given user-level message to the handler log.
143  void log (LogLevel::Enum logLevel, const std::string& str);
144 
145  /// Returns the license expiration date.
146  std::string licenseExpirationDate () const;
147 
148  /// Returns Handler's version.
149  static const char* version ();
150 
151  /// Replay pcap files.
152  /// @note Only realtime feed is supported.
153  /// @note Both Grp and Spin services must be disabled.
154  /// @throw OperationException recovery serveses are not disabled.
155  void replayPcap (const ReplayOptions& options);
156 
157  private:
158  Handler (const Handler&); //no implementation
159  Handler& operator = (const Handler&); //no implementation
160 
161  private:
162  friend struct Implementation::PcapPeplayHelper;
163  struct Impl;
164  Impl* impl_;
165  };
166 
167  /// Replay pcap files.
168  /// @note Only realtime feed is supported.
169  /// @note Both Grp and Spin services must be disabled.
170  /// @throw OperationException recovery serveses are not disabled.
171  ONIXS_CBOECFE_PITCH_API
172  void replayPcap (const std::vector<Handler*>& handlers, const ReplayOptions& options);
173  }
174  }
175  }
176 }
177 
178 
179 
180 
Cboe CFE Multicast PITCH Market Data Handler class.
Definition: Handler.h:51
Is generated when Execution messages are received and contains additional information about instrumen...
Defines params which affect replay.
Definition: Replay.h:80
ONIXS_CBOECFE_PITCH_API void replayPcap(const std::vector< Handler * > &handlers, const ReplayOptions &options)
Enum
Defines the state that the handler is in.