OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.2.1
API documentation
ListenerHolder.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*
4 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
5 *
6 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
7 * and international copyright treaties.
8 *
9 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
10 * Services Agreement (the Agreement) and Customer end user license agreements granting
11 * a non-assignable, non-transferable and non-exclusive license to use the software
12 * for it's own data processing purposes under the terms defined in the Agreement.
13 *
14 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
15 * of this source code or associated reference material to any other location for further reproduction
16 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
17 *
18 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
19 * the terms of the Agreement is a violation of copyright law.
20 */
21 #pragma once
22 
23 #include <OnixS/HandlerCore/HandlerLogger.h>
24 
28 
29 #include "HandlerLogger.h"
30 
31 
32 namespace OnixS {
33 namespace Eurex {
34 namespace MarketData {
35 
36 class WarningListener;
37 class HandlerStateListener;
38 class ReferenceDataListener;
39 class DepthListener;
40 class CachedDepthIncrementalListener;
41 class TopOfBookImpliedListener;
42 class ProductStateChangeListener;
43 class MassInstrumentStateChangeListener;
44 class InstrumentStateChangeListener;
45 class QuoteRequestListener;
46 class CrossRequestListener;
47 class ComplexInstrumentUpdateListener;
48 class FlexibleInstrumentUpdateListener;
49 class OrderBookListener;
50 class TradeListener;
51 class SettlementListener;
52 class OpenInterestListener;
53 class ExchangeTradeListener;
54 
55 class ProductSnapshot;
56 class InstrumentSnapshot;
57 class InstrumentIncremental;
58 class VarianceFuturesStatus;
59 class TotalReturnFuturesStatus;
60 class TradeAtReferencePriceStatus;
61 class TopOfBookImplied;
62 class ProductStateChange;
63 class MassInstrumentStateChange;
64 class InstrumentStateChange;
65 class QuoteRequest;
66 class CrossRequest;
67 class ComplexInstrumentUpdate;
68 class FlexibleInstrumentUpdate;
69 class SnapshotTrade;
70 class IncrementalTrade;
71 class OpenInterest;
72 class Settlement;
73 class ExchangeTrade;
74 class OrderBook;
75 class SnapshotTrade;
76 class IncrementalTrade;
77 class DepthSnapshot;
78 class DepthIncremental;
79 
80 
81 namespace Implementation {
82 
83 class ListenerHolder : public Logging::LogFacility
84 {
85  typedef OnixS::Logging::LogFacility base;
86 
87 public:
88  explicit
89  ListenerHolder (const Logging::LogFacility* parent, HandlerCore::Common::HandlerLogger* logger = nullptr);
90 
91  /*
92  Assign listeners
93  */
94 
95  void set (ErrorListener* listener);
96  void set (WarningListener* listener);
97  void set (HandlerStateListener* listener);
98  void set (ReferenceDataListener* listener);
99  void set (DepthListener* listener);
100  void set (CachedDepthIncrementalListener* listener);
101  void set (TopOfBookImpliedListener* listener);
102  void set (ProductStateChangeListener* listener);
103  void set (MassInstrumentStateChangeListener* listener);
104  void set (InstrumentStateChangeListener* listener);
105  void set (QuoteRequestListener* listener);
106  void set (CrossRequestListener* listener);
107  void set (ComplexInstrumentUpdateListener* listener);
108  void set (FlexibleInstrumentUpdateListener* listener);
109  void set (OrderBookListener* listener);
110  void set (TradeListener* listener);
111  void set (SettlementListener* listener);
112  void set (OpenInterestListener* listener);
113  void set (ExchangeTradeListener* listener);
114 
115 
116  /*
117  Check availability
118  */
119  bool hasErrorListener () const;
120  bool hasWarningListener () const;
121  bool hasHandlerStateListener () const;
122  bool hasReferenceDataListener () const;
123  bool hasDepthListener () const;
124  bool hasCachedDepthIncrementalListener () const;
125  bool hasTopOfBookImplied () const;
126  bool hasProductStateChangeListener () const;
128  bool hasInstrumentStateChangeListener () const;
129  bool hasQuoteRequestListener () const;
130  bool hasCrossRequestListener () const;
133  bool hasOrderBookListener () const;
134  bool hasTradeListener () const;
135  bool hasSettlementListener () const;
136  bool hasOpenInterestListener () const;
137  bool hasExchangeTradeListener () const;
138 
139  /*
140  User callback's
141  */
142  void invokeError (ErrorCode::Enum code, const std::string& description);
143  void invokeWarning (const std::string& description);
144  void invokeStateChanged (HandlerState::Enum newState);
145 
146  void invokeReferenceDataStart ();
147  void invokeReferenceDataProduct (const ProductSnapshot* msg, const DataSource& dataSource);
148  void invokeReferenceDataInstrument (const InstrumentSnapshot* msg, const DataSource& dataSource);
149  void invokeReferenceDataInstrumentUpdate (const InstrumentIncremental* msg, const DataSource& dataSource);
153 
154  void invokeReferenceDataEnd ();
155  void invokeDepthSnapshot (const DepthSnapshot* msg, const DataSource& dataSource);
156  void invokeDepthIncremental (const DepthIncremental* msg, const DataSource& dataSource);
157  void invokeDepthReset (MarketSegmentId marketSegmentId);
158  void invokeDepthOutOfDate (MarketSegmentId marketSegmentId);
159 
160  void invokeCachedDepthIncremental (const DepthIncremental* msg, const DataSource& dataSource);
161 
162  void invokeTopOfBookImplied (const TopOfBookImplied* msg, const DataSource& dataSource);
163  void invokeProductStateChange (const ProductStateChange* msg, const DataSource& dataSource);
164  void invokeMassInstrumentStateChange (const MassInstrumentStateChange* msg, const DataSource& dataSource);
165  void invokeInstrumentStateChange (const InstrumentStateChange* msg, const DataSource& dataSource);
166  void invokeQuoteRequest (const QuoteRequest* msg, const DataSource& dataSource);
167  void invokeCrossRequest (const CrossRequest* msg, const DataSource& dataSource);
168  void invokeComplexInstrumentUpdate (const ComplexInstrumentUpdate* msg, const DataSource& dataSource);
169  void invokeFlexibleInstrumentUpdate (const FlexibleInstrumentUpdate* msg, const DataSource& dataSource);
170 
171  void invokeOrderBookUpdated (const OrderBook& book);
172  void invokeOrderBookOutOfDate (const OrderBook& book);
173 
174  void invokeSnapshotTrade (const SnapshotTrade& trade);
175  void invokeIncrementalTrade (const IncrementalTrade& trade);
176 
177  void invokeOpenInterest(const OpenInterest* msg, const DataSource& dataSource);
178  void invokeSettlement(const Settlement* msg, const DataSource& dataSource);
179  void invokeExchangeTrade(const ExchangeTrade* msg, const DataSource& dataSource);
180 
181  void invokeExchangeTradeReplayCycleStart (UInt32 mdCount, const DataSource& dataSource);
182  void invokeExchangeTradeReplayCycleEnd (const DataSource& dataSource);
183  void invokeOpenInterestReplayCycleStart (UInt32 mdCount, const DataSource& dataSource);
184  void invokeOpenInterestReplayCycleEnd (const DataSource& dataSource);
185  void invokeSettlementReplayCycleStart (UInt32 mdCount, const DataSource& dataSource);
186  void invokeSettlementReplayCycleEnd (const DataSource& dataSource);
187 
188 
189 private:
190  HandlerCore::Common::HandlerLogger* const logger_;
191 
192  ErrorListener* errorListener_;
193  WarningListener* warningListener_;
194  HandlerStateListener* handlerStateListener_;
195 
196  ReferenceDataListener* referenceDataListener_;
197 
198  DepthListener* depthListener_;
199  CachedDepthIncrementalListener* cachedDepthIncrementalListener_;
200 
201  TopOfBookImpliedListener* topOfBookImplied_;
202  ProductStateChangeListener* productStateChangeListener_;
203  MassInstrumentStateChangeListener* massInstrumentStateChangeListener_;
204  InstrumentStateChangeListener* instrumentStateChangeListener_;
205  QuoteRequestListener* quoteRequestListener_;
206  CrossRequestListener* crossRequestListener_;
207  ComplexInstrumentUpdateListener* complexInstrumentUpdateListener_;
208  FlexibleInstrumentUpdateListener* flexibleInstrumentUpdateListener_;
209 
210  OrderBookListener* orderBookListener_;
211  TradeListener* tradeListener_;
212 
213  SettlementListener* settlementListener_;
214  OpenInterestListener* openInterestListener_;
215  ExchangeTradeListener* exchangeTradeListener_;
216 };
217 
218 
219 }}}}
220 
void invokeExchangeTradeReplayCycleStart(UInt32 mdCount, const DataSource &dataSource)
void invokeSettlement(const Settlement *msg, const DataSource &dataSource)
void invokeSettlementReplayCycleEnd(const DataSource &dataSource)
void invokeQuoteRequest(const QuoteRequest *msg, const DataSource &dataSource)
void invokeComplexInstrumentUpdate(const ComplexInstrumentUpdate *msg, const DataSource &dataSource)
void invokeReferenceDataInstrument(const InstrumentSnapshot *msg, const DataSource &dataSource)
void invokeError(ErrorCode::Enum code, const std::string &description)
void invokeOpenInterest(const OpenInterest *msg, const DataSource &dataSource)
void invokeSettlementReplayCycleStart(UInt32 mdCount, const DataSource &dataSource)
void invokeExchangeTrade(const ExchangeTrade *msg, const DataSource &dataSource)
void invokeDepthOutOfDate(MarketSegmentId marketSegmentId)
unsigned int UInt32
Definition: Numeric.h:41
void invokeInstrumentStateChange(const InstrumentStateChange *msg, const DataSource &dataSource)
Definition: Defines.h:30
void invokeReferenceDataTradeAtReferencePriceStatus(const TradeAtReferencePriceStatus *msg, const DataSource &dataSource)
void invokeReferenceDataVarianceFuturesStatus(const VarianceFuturesStatus *msg, const DataSource &dataSource)
void invokeReferenceDataInstrumentUpdate(const InstrumentIncremental *msg, const DataSource &dataSource)
void invokeFlexibleInstrumentUpdate(const FlexibleInstrumentUpdate *msg, const DataSource &dataSource)
void invokeOpenInterestReplayCycleEnd(const DataSource &dataSource)
void invokeCachedDepthIncremental(const DepthIncremental *msg, const DataSource &dataSource)
void invokeOpenInterestReplayCycleStart(UInt32 mdCount, const DataSource &dataSource)
Enum
Known (selected) error codes.
Definition: ErrorListener.h:36
void invokeDepthReset(MarketSegmentId marketSegmentId)
void invokeWarning(const std::string &description)
Enum
Defines the state that the handler is in.
UInt32 MarketSegmentId
Alias for Market Segment ID type.
Definition: Defines.h:40
void invokeDepthIncremental(const DepthIncremental *msg, const DataSource &dataSource)
void invokeDepthSnapshot(const DepthSnapshot *msg, const DataSource &dataSource)
void invokeMassInstrumentStateChange(const MassInstrumentStateChange *msg, const DataSource &dataSource)
void invokeReferenceDataTotalReturnFuturesStatus(const TotalReturnFuturesStatus *msg, const DataSource &dataSource)
void invokeIncrementalTrade(const IncrementalTrade &trade)
void invokeCrossRequest(const CrossRequest *msg, const DataSource &dataSource)
ListenerHolder(const Logging::LogFacility *parent, HandlerCore::Common::HandlerLogger *logger=nullptr)
void invokeReferenceDataProduct(const ProductSnapshot *msg, const DataSource &dataSource)
void invokeTopOfBookImplied(const TopOfBookImplied *msg, const DataSource &dataSource)
void invokeExchangeTradeReplayCycleEnd(const DataSource &dataSource)
void invokeProductStateChange(const ProductStateChange *msg, const DataSource &dataSource)