OnixS BME SENAF Handler C++ library  2.3.0
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
5  * copyright law and international copyright treaties.
6  *
7  * Access to and use of the software is governed by the terms of the applicable
8  * ONIXS Software Services Agreement (the Agreement) and Customer end user
9  * license agreements granting a non-assignable, non-transferable and
10  * non-exclusive license to use the software for it's own data processing
11  * purposes under the terms defined in the Agreement.
12  *
13  * Except as otherwise granted within the terms of the Agreement, copying or
14  * reproduction of any part of this source code or associated reference material
15  * to any other location for further reproduction or redistribution, and any
16  * amendments to this copyright notice, are expressly prohibited.
17  *
18  * Any reproduction or redistribution for sale or hiring of the Software not in
19  * accordance with the terms of the Agreement is a violation of copyright law.
20  */
21 
22 #pragma once
23 
25 #include <OnixS/Senaf/MarketData/Export.h>
37 
38 #include <string>
39 
40 namespace OnixS { namespace Senaf { namespace MarketData {
41 
42 /// \brief The Handler for BME SENAF trading system events.
43 ///
44 /// The `Handler` class is responsible for connecting to the BME SENAF Financial Asset
45 /// Electronic Trading System, processing exchange events, and notifying user code through
46 /// callbacks. It ensures efficient handling of market data, logging, and listener
47 /// registration, providing a robust interface for interacting with the exchange's data feed.
48 class ONIXS_BME_SENAF_EXPORT Handler
49 {
50 public:
51  /// Performs instance initialization.
52  ///
53  /// \param handlerSettings defines values for various settings
54  /// which affect handler behavior like enabling logging
55  /// during execution of the handler.
56  Handler(const HandlerSettings& handlerSettings);
57 
58  /// Finalizes the Handler.
59  virtual ~Handler();
60 
61  /// Retrieves the expiration date of the Handler's license.
62  ///
63  /// This method returns a string representing the date when the Handler's license
64  /// will expire. The expiration date is provided in the format "YYYYMMDD", where:
65  ///
66  /// - YYYY represents the four-digit year,
67  /// - MM represents the two-digit month,
68  /// - DD represents the two-digit day.
69  ///
70  /// This information is useful for ensuring that the Handler's license remains valid
71  /// and for tracking when renewal is required.
72  ///
73  /// \returns A string containing the license expiration date in "YYYYMMDD" format.
74  std::string licenseExpirationDate() const;
75 
76  /// \brief Retrieves the version of the Handler.
77  ///
78  /// This method returns a constant reference to a string representing the version
79  /// of the Handler in the format "X.Y.Z". The version information is useful for
80  /// tracking the Handler's release or update state in the system.
81  ///
82  /// \returns A constant reference to a string containing the version of the Handler.
83  static const std::string& version();
84 
85  /// Logs a debug message for diagnostic purposes.
86  ///
87  /// This method records a debug-level message to the logging system,
88  /// which can be useful for tracking application behavior and troubleshooting.
89  /// It is safe to call this method from any thread.
90  ///
91  /// \param message The debug message to be logged.
92  void logDebug(const std::string& message);
93 
94  /// Logs an error message to the logging system.
95  ///
96  /// This method records an error-level message, which can be critical for
97  /// monitoring application health and diagnosing issues. It is safe to call
98  /// this method from any thread.
99  ///
100  /// \param message The error message to be logged, providing context for the issue.
101  void logError(const std::string& message);
102 
103  /// Logs an informational message to the logging system.
104  ///
105  /// This method records an informational-level message, which can be useful for
106  /// general application logging and monitoring. It is safe to call this method
107  /// from any thread.
108  ///
109  /// \param message The informational message to be logged.
110  void logMessage(const std::string& message);
111 
112  /// Logs a warning message to the logging system.
113  ///
114  /// This method records a warning-level message, which can be useful for
115  /// highlighting potential issues or unusual conditions in the application.
116  /// It is safe to call this method from any thread.
117  ///
118  /// \param message The warning message to be logged.
119  void logWarning(const std::string& message);
120 
121  /// Registers the error listener.
122  ///
123  /// Only single instance of listener can be associated with
124  /// the Handler. Registering new listener removes previous one.
125  ///
126  /// Listeners are to be associated before starting market data
127  /// processing.
128  ///
129  /// \throw exception in case of Handler is in active state.
130  void registerErrorListener(ErrorListener* listener);
131 
132  /// Registers the warning listener.
133  ///
134  /// Only single instance of listener can be associated with
135  /// the Handler. Registering new listener removes previous one.
136  ///
137  /// Listeners are to be associated before starting market data
138  /// processing.
139  ///
140  /// \throw exception in case of Handler is in active state.
141  void registerWarningListener(WarningListener* listener);
142 
143  /// Registers the Handler state change listener.
144  ///
145  /// Only single instance of listener can be associated with
146  /// the Handler. Registering new listener removes previous one.
147  ///
148  /// Listeners are to be associated before starting market data
149  /// processing.
150  ///
151  /// \throw exception in case of Handler is in active state.
152  void registerHandlerStateChangeListener(HandlerStateChangeListener* listener);
153 
154  /// Registers the log replay listener.
155  ///
156  /// Only single instance of listener can be associated with
157  /// the Handler. Registering new listener removes previous one.
158  ///
159  /// Listeners are to be associated before starting market data
160  /// processing.
161  ///
162  /// \throw exception in case of Handler is in active state.
163  void registerLogReplayListener(LogReplayListener* listener);
164 
165  /// Registers the Reference listener.
166  ///
167  /// Only single instance of listener can be associated with
168  /// the Handler. Registering new listener removes previous one.
169  ///
170  /// Listeners are to be associated before starting market data
171  /// processing.
172  ///
173  /// \throw exception in case of Handler is in active state.
174  void registerReferenceListener(ReferenceListener* listener);
175 
176  /// Registers the Security DB listener.
177  ///
178  /// Only single instance of listener can be associated with
179  /// the Handler. Registering new listener removes previous one.
180  ///
181  /// Listeners are to be associated before starting market data
182  /// processing.
183  ///
184  /// \throw exception in case of Handler is in active state.
185  void registerSecurityDbListener(SecurityDbListener* listener);
186 
187  /// Registers the Market Publication Messages listener.
188  ///
189  /// Only single instance of listener can be associated with
190  /// the Handler. Registering new listener removes previous one.
191  ///
192  /// Listeners are to be associated before starting market data
193  /// processing.
194  ///
195  /// \throw exception in case of Handler is in active state.
196  void registerMarketPublicationListener(MarketPublicationListener* listener);
197 
198  /// Registers the Market Control Messages listener.
199  ///
200  /// Only single instance of listener can be associated with
201  /// the Handler. Registering new listener removes previous one.
202  ///
203  /// Listeners are to be associated before starting market data
204  /// processing.
205  ///
206  /// \throw exception in case of Handler is in active state.
207  void registerMarketControlListener(MarketControlListener* listener);
208 
209  /// Registers the order book update listener.
210  ///
211  /// Only single instance of listener can be associated with
212  /// the Handler. Registering new listener removes previous one.
213  ///
214  /// Listeners are to be associated before starting market data
215  /// processing.
216  ///
217  /// \throw exception in case of Handler is in active state.
218  void registerOrderBookUpdateListener(OrderBookUpdateListener* listener);
219 
220  /// Registers the Private Management Messages listener.
221  ///
222  /// Only single instance of listener can be associated with
223  /// the Handler. Registering new listener removes previous one.
224  ///
225  /// Listeners are to be associated before starting market data
226  /// processing.
227  ///
228  /// \throw exception in case of Handler is in active state.
229  void registerPrivateManagementListener(PrivateManagementListener* listener);
230 
231  /// Subscribes to market data updates based on the provided subscription details.
232  ///
233  /// This method registers the specified market subscription, allowing the Handler
234  /// to receive updates related to the market events specified in the subscription.
235  /// It is safe to call this method from any thread.
236  ///
237  /// \param subscription The details of the market subscription to be registered.
238  void subscribe(const MarketSubscription& subscription);
239 
240  /// Starts the Handler.
241  ///
242  /// \throw exception in case of unable to establish TCP connection.
243  void start();
244 
245  /// Stops the Handler.
246  void stop();
247 
248  /// Retrieves the current state of the Handler.
249  ///
250  /// This method is safe for concurrent access across multiple threads.
251  ///
252  /// \returns The current state of the Handler that indicates the Handler's operational status.
253  HandlerStates::Enum state() const;
254 
255 private:
256  Handler(const Handler&) /*= delete */; // no implementation
257  Handler& operator=(const Handler&) /*= delete */; // no implementation
258 
259 private:
260  class Implementation;
261  Implementation* impl_;
262 };
263 
264 }}} // namespace OnixS::Senaf::MarketData
Enum
Available Handler&#39;s states.
Definition: HandlerState.h:32
The Handler for BME SENAF trading system events.
Definition: Handler.h:48
Defines set of settings which affect behavior of the Handler.
Defines the interface through which the Handler notifies subscribers about reference events...
Defines the interface through which the Handler notifies subscribers about log replay events...
Defines the interface through which the Handler notifies subscribers about Market Publication Message...
Defines the interface through which the Handler notifies subscribers about errors occurred while proc...
Definition: ErrorListener.h:31
Defines the interface through which the Handler notifies subscribers about security DB events...
Defines the interface through which the Handler notifies subscribers about Market Control Messages...