OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
API documentation
MdiProductDataRepository.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 
24 
25 #include "MessageQueue.h"
26 #include "EditableOrderBook.h"
27 #include "ListenerHolder.h"
28 #include "InternalDefines.h"
29 
30 namespace OnixS {
31 namespace Eurex {
32 namespace MarketData {
33 namespace Implementation {
34 
35 class MdiProductDataRepository;
36 
38 {
39  SecurityContext(bool createBook, SecurityId securityId, MdiProductDataRepository* repository);
40 
41  void synchronized(bool value) { synchronized_ = value; }
42 
43  bool synchronized() const { return synchronized_; }
44  EditableOrderBook* book() { return book_.get(); }
45 
46  void reset();
47 
48 private:
49  bool synchronized_;
50  boost::scoped_ptr<EditableOrderBook> book_;
51 };
52 
53 class MdiProductDataRepository : public Logging::LogFacility
54 {
55  typedef OnixS::Logging::LogFacility base;
56  typedef boost::function<bool(SecurityId)> SecurityIdFilter;
57 
58 public:
60  MarketSegmentId marketSegmentId,
61  MarketDepth marketDepth,
62  bool buildInternalOrderBooks,
63  LogFacility* parent,
64  HandlerCore::Common::HandlerLogger* logger,
65  ListenerHolder* listenerHolder,
66  const HandlerSettings& settings,
67  SecurityIdFilter filterSecurityId);
68 
69  SecurityContext* getOrCreateSecurityContext(SecurityId id);
70 
71  void reset();
72 
73  void processMessage(const CORE::Message&, TemplateId, const DataSource&);
74  void processDepthSnapshot(const CORE::Message& msg, const DataSource& dataSource);
75  void processDepthIncremental(const CORE::Message& msg, const DataSource& dataSource);
76 
77  void noDataOnIncrementalFeeds();
78 
79  MarketSegmentId marketSegmentId() const ;
80 
81 private:
82  // Log helper.
83  template<typename TMsg>
84  void log (const TMsg & msg)
85  {
86  if (logger_)
87  logger_->log (msg);
88  }
89 
90 private:
91  HandlerCore::Common::HandlerLogger* const logger_;
92  ListenerHolder* const listenerHolder_;
93  const HandlerSettings& settings_;
94  const MarketSegmentId marketSegmentId_;
95  const MarketDepth marketDepth_;
96  const bool buildInternalOrderBooks_;
97  const SecurityIdFilter filterSecurityId_;
98 
99  SequenceNumber nextMsgSeqNum_;
100  bool synchronized_;
101 
102  typedef boost::shared_ptr<SecurityContext> SecurityContextPtr;
103  typedef std::map<SecurityId, SecurityContextPtr> SecurityContexts;
104  typedef SecurityContexts::const_iterator SecurityContextsEntry;
105  SecurityContexts securityContexts_;
106 
107  friend struct SecurityContext;
108 };
109 
110 
111 }}}}
112 
unsigned int SequenceNumber
Alias for sequence numbers.
UInt32 MarketDepth
Alias for Market depth type.
Definition: Defines.h:43
Handler base configuration settings.
Definition: Defines.h:30
Int64 SecurityId
Alias for Security Id type.
Definition: Defines.h:51
SecurityContext(bool createBook, SecurityId securityId, MdiProductDataRepository *repository)
UInt32 MarketSegmentId
Alias for Market Segment ID type.
Definition: Defines.h:40
OnixS::FIX::Core::FAST::TemplateId TemplateId