OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
API documentation
RdiHandler.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 "RdiHandlerImpl.h"
24 #include "Version.h"
25 
26 #include <OnixS/HandlerCore/ErrorBuilder.h>
27 
28 #if defined(_DEBUG) && defined(WIN32) && defined(DEBUG_MEM)
29 #undef new
30 #define new DEBUG_NEW
31 #endif
32 
33 namespace OnixS {
34 namespace Eurex {
35 namespace MarketData {
36 
37 using namespace HandlerCore::MarketData;
38 using namespace HandlerCore::Common;
39 
41 : impl_(nullptr)
42 {
43  try
44  {
45  impl_ = new Impl(settings);
46  }
47  catch (const std::exception& ex)
48  {
49  ErrorBuilder errorBuilder;
50  errorBuilder << "Unable to create RDI Handler: " << ex.what();
51  errorBuilder.toError();
52  }
53  catch (...)
54  {
55  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to create RDI handler");
56  }
57 }
58 
60 {
61  if( impl_ != nullptr )
62  delete impl_;
63 }
64 
66 {
67  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
68  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
69 }
70 
72 {
73  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
74  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
75 }
76 
78 {
79  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
80  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
81 }
82 
84 {
85  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
86  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
87 }
88 
90 {
91  if (HandlerState::Stopped == state()) impl_->bindFeedEngine(feedEngine);
92  else throw OperationException(BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
93 }
94 
96 {
97  if (HandlerState::Stopped != state())
98  throw OperationException (BOOST_CURRENT_FUNCTION, "Handler already started");
99 
100  impl_->start();
101 }
102 
103 
104 void RdiHandler::start(const ReplayOptions& options)
105 {
106  if (HandlerState::Stopped != state())
107  throw OperationException (BOOST_CURRENT_FUNCTION, "Handler already started");
108 
109  impl_->start(options);
110 }
111 
113 {
114  impl_->stop();
115 }
116 
117 /*
118  Logging
119 */
120 
121 void RdiHandler::log (OnixS::Eurex::MarketData::LogLevel::Enum logLevel, const char * logMessage, size_t length)
122 {
123  impl_->commonLog (int (logLevel), logMessage, length);
124 }
125 
126 void RdiHandler::log (OnixS::Eurex::MarketData::LogLevel::Enum logLevel, const char * logMessage)
127 {
128  impl_->commonLog (int (logLevel), logMessage, strlen (logMessage));
129 }
130 
131 void RdiHandler::log (OnixS::Eurex::MarketData::LogLevel::Enum logLevel, const std::string& str)
132 {
133  impl_->commonLog (int (logLevel), str.c_str(), str.length());
134 }
135 
136 /*
137  Information requests
138 */
139 
141 {
142  return impl_->licenseExpirationDate().c_str();
143 }
144 
145 const char* RdiHandler::version()
146 {
148 }
149 
151 {
152  return HandlerState::Enum(impl_->getState());
153 }
154 
156 {
157  return impl_->findEmdiDescriptors(productNames);
158 }
159 
161 {
162  return impl_->findAllEmdiDescriptors();
163 }
164 
166 {
167  return impl_->findMdiDescriptors(productNames);
168 }
169 
171 {
172  return impl_->findAllMdiDescriptors();
173 }
174 
176 {
177  return impl_->findEobiDescriptors(productNames);
178 }
179 
181 {
182  return impl_->findAllEobiDescriptors();
183 }
184 }}}
185 
EmdiDescriptors findAllEmdiDescriptors() const
Definition: RdiHandler.cpp:160
void log(LogLevel::Enum logLevel, const char *logMessage, size_t length)
Logs the given user-level message to the handler log.
Definition: RdiHandler.cpp:121
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:287
const char * licenseExpirationDate() const
Returns the license expiration date.
Definition: RdiHandler.cpp:140
EobiDescriptors findEobiDescriptors(const MarketSegments &productNames) const
Returns list of descriptors of EOB interfaces for given product name list.
ListenerHolder & listenerHolder()
Returns commons services as shared object.
void registerWarningListener(WarningListener *listener)
Definition: RdiHandler.cpp:71
HandlerState::Enum state() const
Returns handler state.
Definition: RdiHandler.cpp:150
static const char * version()
Returns Handler&#39;s version.
Definition: RdiHandler.cpp:145
EobiDescriptor::Collection EobiDescriptors
EmdiDescriptors findAllEmdiDescriptors() const
Returns list of descriptors of EMDI interfaces for all products.
EobiDescriptors findAllEobiDescriptors() const
Returns list of descriptors of EOB interfaces for all products.
void commonLog(int logLevel, const char *msg, size_t length)
User&#39;s common log.
Definition: Defines.h:30
Defines params which affect logs replay.
Definition: Replay.h:77
MdiDescriptors findAllMdiDescriptors() const
Returns list of descriptors of MDI interfaces for all products.
RDI handler configuration settings.
MdiDescriptors findMdiDescriptors(const MarketSegments &productNames) const
Definition: RdiHandler.cpp:165
virtual ~RdiHandler()
Finalizes the Handler.
Definition: RdiHandler.cpp:59
void bindFeedEngine(FeedEngine &feedEngine)
Definition: RdiHandler.cpp:89
void registerHandlerStateListener(HandlerStateListener *listener)
Definition: RdiHandler.cpp:77
EmdiDescriptor::Collection EmdiDescriptors
void registerErrorListener(ErrorListener *listener)
Definition: RdiHandler.cpp:65
RdiHandler(const RdiHandlerSettings &settings)
Definition: RdiHandler.cpp:40
MdiDescriptor::Collection MdiDescriptors
void set(ErrorListener *listener) ONIXS_NOEXCEPT
EmdiDescriptors findEmdiDescriptors(const MarketSegments &productNames) const
Returns list of descriptors of EMDI interfaces for given product name list.
EobiDescriptors findAllEobiDescriptors() const
Definition: RdiHandler.cpp:180
EobiDescriptors findEobiDescriptors(const MarketSegments &productNames) const
Definition: RdiHandler.cpp:175
Enum
Defines the state that the handler is in.
MdiDescriptors findMdiDescriptors(const MarketSegments &productNames) const
Returns list of descriptors of MDI interfaces for given product name list.
EmdiDescriptors findEmdiDescriptors(const MarketSegments &productNames) const
Definition: RdiHandler.cpp:155
void registerReferenceDataListener(ReferenceDataListener *listener)
Definition: RdiHandler.cpp:83
MdiDescriptors findAllMdiDescriptors() const
Definition: RdiHandler.cpp:170