OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
API documentation
EobiListenerHolder.cpp
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 
22 
23 #include "../HandlerLogger.h"
24 #include "EobiBookImpl.h"
25 
26 #include "EobiListenerHolder.h"
27 
28 
29 
30 using namespace OnixS::Eurex::MarketData;
31 using namespace OnixS::Eurex::MarketData::EOBI;
34 using namespace OnixS::HandlerCore::Common;
35 using namespace OnixS::Logging;
36 
37 
38 EobiListenerHolder::EobiListenerHolder(const LogFacility* parent, HandlerLogger* logger)
39  : base("EobiListenerHolder", parent, OnixS::Logging::LOG_LEVEL_DEBUG),
40  logger_(logger),
41  errorListener_(nullptr),
42  warningListener_(nullptr),
43  handlerStateListener_(nullptr),
44  orderDataListener_(nullptr),
45  tradeDataListener_(nullptr),
46  stateChangeListener_(nullptr),
47  referenceDataListener_(nullptr),
48  snapshotListener_(nullptr),
49  messageListener_(nullptr),
50  orderBookListener_(nullptr),
51  packetListener_(nullptr)
52 {
53  BOOST_ASSERT(logger_ != nullptr);
54 }
55 
57  OnixS::Eurex::MarketData::ErrorCode::Enum code, const std::string& description) ONIXS_NOEXCEPT
58 {
59  if (ErrorListener* listener = errorListener_)
60  {
61  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onError(code, description), "onError");
62  }
63 }
64 
66  const std::string& description) ONIXS_NOEXCEPT
67 {
68  if (WarningListener* listener = warningListener_)
69  {
70  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onWarning(description), "onWarning");
71  }
72 }
73 
75  OnixS::Eurex::MarketData::HandlerState::Enum newState) ONIXS_NOEXCEPT
76 {
77  if (HandlerStateListener* listener = handlerStateListener_)
78  {
79  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onStateChanged(newState), "onStateChanged");
80  }
81 }
82 
83 void EobiListenerHolder::invokeOrderAdd(const OrderAdd& orderAdd) ONIXS_NOEXCEPT
84 {
85  if (OrderDataListener* listener = orderDataListener_)
86  {
87  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderAdd(orderAdd), "onOrderAdd");
88  }
89 }
90 
91 void EobiListenerHolder::invokeOrderModify(const OrderModify& orderModify) ONIXS_NOEXCEPT
92 {
93  if (OrderDataListener* listener = orderDataListener_)
94  {
95  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderModify(orderModify), "onOrderModify");
96  }
97 }
98 
100  const OrderModifySamePriority& orderModifySamePriority) ONIXS_NOEXCEPT
101 {
102  if (OrderDataListener* listener = orderDataListener_)
103  {
104  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderModifySamePriority(orderModifySamePriority),
105  "onOrderModifySamePriority");
106  }
107 }
108 
110  const OrderDelete& orderDelete) ONIXS_NOEXCEPT
111 {
112  if (OrderDataListener* listener = orderDataListener_)
113  {
114  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderDelete(orderDelete), "onOrderDelete");
115  }
116 }
117 
119  const OrderMassDelete& orderMassDelete) ONIXS_NOEXCEPT
120 {
121  if (OrderDataListener* listener = orderDataListener_)
122  {
123  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderMassDelete(orderMassDelete), "onOrderMassDelete");
124  }
125 }
126 
128  const FullOrderExecution& fullOrderExecution) ONIXS_NOEXCEPT
129 {
130  if (OrderDataListener* listener = orderDataListener_)
131  {
132  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onFullOrderExecution(fullOrderExecution), "onFullOrderExecution");
133  }
134 }
135 
137  const PartialOrderExecution& partialOrderExecution) ONIXS_NOEXCEPT
138 {
139  if (OrderDataListener* listener = orderDataListener_)
140  {
141  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onPartialOrderExecution(partialOrderExecution),
142  "onPartialOrderExecution");
143  }
144 }
145 
146 void EobiListenerHolder::invokeTradeReversal(const TradeReversal& tradeReversal) ONIXS_NOEXCEPT
147 {
148  if (TradeDataListener* listener = tradeDataListener_)
149  {
150  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onTradeReversal(tradeReversal), "onTradeReversal");
151  }
152 }
153 
154 void EobiListenerHolder::invokeTradeReport(const TradeReport& tradeReport) ONIXS_NOEXCEPT
155 {
156  if (TradeDataListener* listener = tradeDataListener_)
157  {
158  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onTradeReport(tradeReport), "onTradeReport");
159  }
160 }
161 
162 void EobiListenerHolder::invokeExecutionSummary(const ExecutionSummary& executionSummary) ONIXS_NOEXCEPT
163 {
164  if (TradeDataListener* listener = tradeDataListener_)
165  {
166  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onExecutionSummary(executionSummary), "onExecutionSummary");
167  }
168 }
169 
170 void EobiListenerHolder::invokeProductStateChange(const EOBI::ProductStateChange& productStateChange) ONIXS_NOEXCEPT
171 {
172  if (StateChangeListener* listener = stateChangeListener_)
173  {
174  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onProductStateChange(productStateChange), "onProductStateChange");
175  }
176 }
177 
179  const EOBI::InstrumentStateChange& instrumentStateChange) ONIXS_NOEXCEPT
180 {
181  if (StateChangeListener* listener = stateChangeListener_)
182  {
183  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onInstrumentStateChange(instrumentStateChange),
184  "onInstrumentStateChange");
185  }
186 }
187 
189  const EOBI::MassInstrumentStateChange& massInstrumentStateChange) ONIXS_NOEXCEPT
190 {
191  if (StateChangeListener* listener = stateChangeListener_)
192  {
193  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onMassInstrumentStateChange(massInstrumentStateChange),
194  "onMassInstrumentStateChange");
195  }
196 }
197 
198 void EobiListenerHolder::invokeAddComplexInstrument(const AddComplexInstrument& addComplexInstrument) ONIXS_NOEXCEPT
199 {
200  if (ReferenceDataListener* listener = referenceDataListener_)
201  {
202  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onAddComplexInstrument(addComplexInstrument),
203  "onAddComplexInstrument");
204  }
205 }
206 
207 void EobiListenerHolder::invokeAuctionBestBidOffer(const AuctionBestBidOffer& auctionBestBidOffer) ONIXS_NOEXCEPT
208 {
209  if (OrderDataListener* listener = orderDataListener_)
210  {
211  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onAuctionBestBidOffer(auctionBestBidOffer), "onAuctionBestBidOffer");
212  }
213 }
214 
215 void EobiListenerHolder::invokeAuctionClearingPrice(const AuctionClearingPrice& auctionClearingPrice) ONIXS_NOEXCEPT
216 {
217  if (OrderDataListener* listener = orderDataListener_)
218  {
219  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onAuctionClearingPrice(auctionClearingPrice),
220  "onAuctionClearingPrice");
221  }
222 }
223 
224 void EobiListenerHolder::invokeCrossRequest(const EOBI::CrossRequest& crossRequest) ONIXS_NOEXCEPT
225 {
226  if (TradeDataListener* listener = tradeDataListener_)
227  {
228  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onCrossRequest(crossRequest), "onCrossRequest");
229  }
230 }
231 
232 void EobiListenerHolder::invokeQuoteRequest(const EOBI::QuoteRequest& quoteRequest) ONIXS_NOEXCEPT
233 {
234  if (TradeDataListener* listener = tradeDataListener_)
235  {
236  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onQuoteRequest(quoteRequest), "onQuoteRequest");
237  }
238 }
239 
240 void EobiListenerHolder::invokeTopOfBook(const TopOfBook& topOfBook) ONIXS_NOEXCEPT
241 {
242  if (OrderDataListener* listener = orderDataListener_)
243  {
244  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onTopOfBook(topOfBook), "onTopOfBook");
245  }
246 }
247 
248 void EobiListenerHolder::invokeProductSummary(const ProductSummary& productSummary) ONIXS_NOEXCEPT
249 {
250  if (SnapshotListener* listener = snapshotListener_)
251  {
252  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onProductSummary(productSummary), "onProductSummary");
253  }
254 }
255 
256 void EobiListenerHolder::invokeInstrumentSummary(const InstrumentSummary& instrumentSummary) ONIXS_NOEXCEPT
257 {
258  if (SnapshotListener* listener = snapshotListener_)
259  {
260  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onInstrumentSummary(instrumentSummary), "onInstrumentSummary");
261  }
262 }
263 
264 void EobiListenerHolder::invokeSnapshotOrder(const SnapshotOrder& snapshotOrder) ONIXS_NOEXCEPT
265 {
266  if (SnapshotListener* listener = snapshotListener_)
267  {
268  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onSnapshotOrder(snapshotOrder), "onSnapshotOrder");
269  }
270 }
271 
273 {
274  if (SnapshotListener* listener = snapshotListener_)
275  {
276  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onSnapshotCycleBegin(), "onSnapshotCycleBegin");
277  }
278 }
279 
281 {
282  if (SnapshotListener* listener = snapshotListener_)
283  {
284  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onSnapshotCycleEnd(), "onSnapshotCycleEnd");
285  }
286 }
287 
288 void EobiListenerHolder::invokeDepthReset(MarketSegmentId marketSegmentId) ONIXS_NOEXCEPT
289 {
290  if (MessageListener* listener = messageListener_)
291  {
292  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onMarketSegmentReset(marketSegmentId), "onMarketSegmentReset");
293  }
294 }
295 
296 void EobiListenerHolder::invokeDepthOutOfDate(MarketSegmentId marketSegmentId) ONIXS_NOEXCEPT
297 {
298  if (MessageListener* listener = messageListener_)
299  {
300  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onMarketSegmentOutOfDate(marketSegmentId),
301  "onMarketSegmentOutOfDate");
302  }
303 }
304 
306 {
307  if (OrderBookListener* listener = orderBookListener_)
308  {
309  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderBookUpdated(book), "onOrderBookUpdated");
310  }
311 }
312 
314 {
315  if (OrderBookListener* listener = orderBookListener_)
316  {
317  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onOrderBookOutOfDate(book), "onOrderBookOutOfDate");
318  }
319 }
320 
321 void EobiListenerHolder::invokePacketProcessingBegin(const DataSource& dataSource) ONIXS_NOEXCEPT
322 {
323  if (PacketListener* listener = packetListener_)
324  {
325  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onPacketProcessingBegin(dataSource), "onPacketProcessingBegin");
326  }
327 }
328 
329 void EobiListenerHolder::invokePacketProcessingEnd(const DataSource& dataSource) ONIXS_NOEXCEPT
330 {
331  if (PacketListener* listener = packetListener_)
332  {
333  ONIXS_EXCEPTION_TRACED_CALLBACK(listener->onPacketProcessingEnd(dataSource), "onPacketProcessingEnd");
334  }
335 }
336 
337 
338 
339 void EobiListenerHolder::set(OrderBookListener* orderBookListener) ONIXS_NOEXCEPT
340 {
341  orderBookListener_ = orderBookListener;
342 }
343 
344 void EobiListenerHolder::set(SnapshotListener* snapshotListener) ONIXS_NOEXCEPT
345 {
346  snapshotListener_ = snapshotListener;
347 }
348 
349 void EobiListenerHolder::set(ReferenceDataListener* referenceDataListener) ONIXS_NOEXCEPT
350 {
351  referenceDataListener_ = referenceDataListener;
352 }
353 
354 void EobiListenerHolder::set(StateChangeListener* stateChangeListener) ONIXS_NOEXCEPT
355 {
356  stateChangeListener_ = stateChangeListener;
357 }
358 
359 void EobiListenerHolder::set(TradeDataListener* tradeDataListener) ONIXS_NOEXCEPT
360 {
361  tradeDataListener_ = tradeDataListener;
362 }
363 
364 void EobiListenerHolder::set(OrderDataListener* orderDataListener) ONIXS_NOEXCEPT
365 {
366  orderDataListener_ = orderDataListener;
367 }
368 
369 void EobiListenerHolder::set(HandlerStateListener* listener) ONIXS_NOEXCEPT
370 {
371  handlerStateListener_ = listener;
372 }
373 
374 void EobiListenerHolder::set(WarningListener* listener) ONIXS_NOEXCEPT
375 {
376  warningListener_ = listener;
377 }
378 
379 void EobiListenerHolder::set(ErrorListener* listener) ONIXS_NOEXCEPT
380 {
381  errorListener_ = listener;
382 }
383 
384 void EobiListenerHolder::set(MessageListener* messageListener) ONIXS_NOEXCEPT
385 {
386  messageListener_ = messageListener;
387 }
388 
389 void EobiListenerHolder::set(PacketListener * packetListener) ONIXS_NOEXCEPT
390 {
391  packetListener_ = packetListener;
392 }
393 
394 bool EobiListenerHolder::hasErrorListener() const ONIXS_NOEXCEPT
395 {
396  return (errorListener_ != nullptr);
397 }
398 
399 bool EobiListenerHolder::hasWarningListener() const ONIXS_NOEXCEPT
400 {
401  return (warningListener_ != nullptr);
402 }
403 
405 {
406  return (handlerStateListener_ != nullptr);
407 }
408 
409 bool EobiListenerHolder::hasOrderDataListener() const ONIXS_NOEXCEPT
410 {
411  return (orderDataListener_ != nullptr);
412 }
413 
414 bool EobiListenerHolder::hasTradeDataListener() const ONIXS_NOEXCEPT
415 {
416  return (tradeDataListener_ != nullptr);
417 }
418 
420 {
421  return (stateChangeListener_ != nullptr);
422 }
423 
425 {
426  return (referenceDataListener_ != nullptr);
427 }
428 
429 bool EobiListenerHolder::hasSnapshotListener() const ONIXS_NOEXCEPT
430 {
431  return (snapshotListener_ != nullptr);
432 }
433 
434 bool EobiListenerHolder::hasMessageListener() const ONIXS_NOEXCEPT
435 {
436  return (messageListener_ != nullptr);
437 }
438 
439 bool EobiListenerHolder::hasOrderBookListener() const ONIXS_NOEXCEPT
440 {
441  return (orderBookListener_ != nullptr);
442 }
443 
444 bool EobiListenerHolder::hasPacketListener() const ONIXS_NOEXCEPT
445 {
446  return (packetListener_ != nullptr);
447 }
void invokeTopOfBook(const TopOfBook &topOfBookListener) ONIXS_NOEXCEPT
void invokeProductSummary(const ProductSummary &productSummaryListener) ONIXS_NOEXCEPT
void invokeOrderMassDelete(const OrderMassDelete &orderMassDeleteListener) ONIXS_NOEXCEPT
void invokeOrderBookOutOfDate(const OrderBookInternal &) ONIXS_NOEXCEPT
void invokeTradeReport(const TradeReport &tradeReportListener) ONIXS_NOEXCEPT
void invokeOrderModify(const OrderModify &orderModifyListener) ONIXS_NOEXCEPT
void invokeFullOrderExecution(const FullOrderExecution &fullOrderExecutionListener) ONIXS_NOEXCEPT
void invokeStateChanged(HandlerState::Enum newState) ONIXS_NOEXCEPT
EobiListenerHolder(const Logging::LogFacility *parent, HandlerCore::Common::HandlerLogger *logger=nullptr)
void invokeDepthReset(MarketSegmentId marketSegmentId) ONIXS_NOEXCEPT
void invokeExecutionSummary(const ExecutionSummary &executionSummaryListener) ONIXS_NOEXCEPT
void invokeTradeReversal(const TradeReversal &tradeReversalListener) ONIXS_NOEXCEPT
void invokeQuoteRequest(const QuoteRequest &quoteRequestListener) ONIXS_NOEXCEPT
Definition: Defines.h:30
Product State Change listener.
void invokeCrossRequest(const CrossRequest &crossRequestListener) ONIXS_NOEXCEPT
void invokeMassInstrumentStateChange(const MassInstrumentStateChange &instrumentStateChangeListener) ONIXS_NOEXCEPT
void invokeInstrumentSummary(const InstrumentSummary &instrumentSummaryListener) ONIXS_NOEXCEPT
void invokeWarning(const std::string &description) ONIXS_NOEXCEPT
void invokeOrderBookUpdated(const OrderBookInternal &) ONIXS_NOEXCEPT
void invokeOrderDelete(const OrderDelete &orderDeleteListener) ONIXS_NOEXCEPT
Enum
Known (selected) error codes.
Definition: ErrorListener.h:36
void invokeAuctionBestBidOffer(const AuctionBestBidOffer &auctionBestBidOfferListener) ONIXS_NOEXCEPT
void invokeOrderModifySamePriority(const OrderModifySamePriority &orderModifyListener) ONIXS_NOEXCEPT
Enum
Defines the state that the handler is in.
void invokeSnapshotOrder(const SnapshotOrder &snapshotOrderListener) ONIXS_NOEXCEPT
UInt32 MarketSegmentId
Alias for Market Segment ID type.
Definition: Defines.h:40
#define ONIXS_EXCEPTION_TRACED_CALLBACK(callback, contextName)
void invokeOrderAdd(const OrderAdd &orderAddListener) ONIXS_NOEXCEPT
void invokeAuctionClearingPrice(const AuctionClearingPrice &auctionClearingPriceListener) ONIXS_NOEXCEPT
void invokeAddComplexInstrument(const AddComplexInstrument &addComplexInstrumentListener) ONIXS_NOEXCEPT
void invokeInstrumentStateChange(const InstrumentStateChange &instrumentStateChangeListener) ONIXS_NOEXCEPT
void invokeError(ErrorCode::Enum code, const std::string &description) ONIXS_NOEXCEPT
void invokeProductStateChange(const ProductStateChange &productStateChangeListener) ONIXS_NOEXCEPT
void invokeDepthOutOfDate(MarketSegmentId marketSegmentId) ONIXS_NOEXCEPT
void invokePartialOrderExecution(const PartialOrderExecution &partialOrderExecutionListener) ONIXS_NOEXCEPT