OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
API documentation
EobiHandler.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 "EobiHandlerImpl.h"
24 
25 #include <OnixS/HandlerCore/ErrorBuilder.h>
26 
27 namespace OnixS {
28 namespace Eurex {
29 namespace MarketData {
30 namespace EOBI {
31 
32 using namespace HandlerCore::MarketData;
33 using namespace HandlerCore::Common;
34 
36 : impl_(nullptr)
37 {
38  try
39  {
40  impl_ = new Impl(settings);
41  }
42  catch (const std::exception& ex)
43  {
44  ErrorBuilder errorBuilder;
45  errorBuilder << "Unable to create EOBI Handler: " << ex.what();
46  errorBuilder.toError();
47  }
48  catch (...)
49  {
50  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to create EOBI handler");
51  }
52 }
53 
55 {
56  if( impl_ != nullptr )
57  delete impl_;
58 }
59 
60 
62 {
63  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
64  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
65 }
66 
68 {
69  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
70  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
71 }
72 
74 {
75  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
76  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
77 }
78 
80 {
81  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
82  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
83 }
84 
86 {
87  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
88  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
89 }
90 
92 {
93  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
94  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
95 }
96 
98 {
99  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
100  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
101 }
102 
104 {
105  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
106  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
107 }
108 
110 {
111  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
112  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
113 }
114 
116 {
117  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
118  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
119 }
120 
122 {
123  if (HandlerState::Stopped == state()) impl_->listenerHolder().set (listener);
124  else throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
125 }
126 
128 {
129  if (HandlerState::Stopped == state()) impl_->bindFeedEngine(feedEngine);
130  else throw OperationException(BOOST_CURRENT_FUNCTION, "Unable to change listener while handler connected");
131 }
132 
134 {
135  if (HandlerState::Stopped != state())
136  throw OperationException (BOOST_CURRENT_FUNCTION, "Handler already started");
137 
138  impl_->start();
139 }
140 
141 void EobiHandler::start(const ReplayOptions& options)
142 {
143  if (HandlerState::Stopped != state())
144  throw OperationException (BOOST_CURRENT_FUNCTION, "Handler already started");
145 
146  impl_->start(options);
147 }
148 
150 {
151  impl_->stop();
152 }
153 
154 /*
155  Logging
156 */
157 
158 void EobiHandler::log (OnixS::Eurex::MarketData::LogLevel::Enum logLevel, const char * logMessage, size_t length)
159 {
160  impl_->commonLog (int (logLevel), logMessage, length);
161 }
162 
163 void EobiHandler::log (OnixS::Eurex::MarketData::LogLevel::Enum logLevel, const char * logMessage)
164 {
165  impl_->commonLog (int (logLevel), logMessage, strlen (logMessage));
166 }
167 
168 void EobiHandler::log (OnixS::Eurex::MarketData::LogLevel::Enum logLevel, const std::string& str)
169 {
170  impl_->commonLog (int (logLevel), str.c_str(), str.length());
171 }
172 
173 /*
174  Information requests
175 */
176 
178 {
179  return impl_->licenseExpirationDate().c_str();
180 }
181 
182 const char* EobiHandler::version()
183 {
185 }
186 
188 {
189  return HandlerState::Enum(impl_->getState());
190 }
191 
192 
194 {
195  if (HandlerState::Stopped == state())
196  impl_->setPartitionIdFilters(filters);
197  else
198  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change PartitionIdFilters while handler connected");
199 }
200 
202 {
203  if (HandlerState::Stopped == state())
205  else
206  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change PartitionIdFilters while handler connected");
207 }
208 
210 {
211  if (HandlerState::Stopped == state())
212  impl_->setMarketSegmentIdFilters(filters);
213  else
214  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change MarketSegmentIdFilters while handler connected");
215 }
216 
218 {
219  if (HandlerState::Stopped == state())
221  else
222  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change MarketSegmentIdFilters while handler connected");
223 }
224 
226 {
227  if (HandlerState::Stopped == state())
228  impl_->setSecurityIdFilters(filters);
229  else
230  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change SecurityIdFilters while handler connected");
231 }
232 
234 {
235  if (HandlerState::Stopped == state())
237  else
238  throw OperationException (BOOST_CURRENT_FUNCTION, "Unable to change SecurityIdFilters while handler connected");
239 }
240 
241 
242 }}}}
243 
void setSecurityIdFilters(const SecurityIdFilters &filters)
void registerErrorListener(ErrorListener *listener)
Definition: EobiHandler.cpp:61
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:287
void registerStateChangeListener(StateChangeListener *listener)
Definition: EobiHandler.cpp:91
void registerMessageListener(MessageListener *listener)
void registerOrderDataListener(OrderDataListener *listener)
Definition: EobiHandler.cpp:79
FilteringTraits::PartitionIdFilters PartitionIdFilters
void registerReferenceDataListener(ReferenceDataListener *listener)
Definition: EobiHandler.cpp:97
void log(LogLevel::Enum logLevel, const char *logMessage, size_t length)
Logs the given user-level message to the handler log.
void commonLog(int logLevel, const char *msg, size_t length)
User&#39;s common log.
Definition: Defines.h:30
void registerTradeDataListener(TradeDataListener *listener)
Definition: EobiHandler.cpp:85
Product State Change listener.
void registerHandlerStateListener(HandlerStateListener *listener)
Definition: EobiHandler.cpp:73
FilteringTraits::MarketSegmentIdFilters MarketSegmentIdFilters
void bindFeedEngine(FeedEngine &feedEngine)
Defines params which affect logs replay.
Definition: Replay.h:77
void setPartitionIdFilters(const PartitionIdFilters &filters)
EobiHandler(const EobiHandlerSettings &settings)
Definition: EobiHandler.cpp:35
void setPartitionIdFilters(const PartitionIdFilters &filters)
const char * licenseExpirationDate() const
Returns the license expiration date.
void registerOrderBookListener(OrderBookListener *listener)
EOBI handler configuration settings.
void setMarketSegmentIdFilters(const MarketSegmentIdFilters &filters)
void removeAllMarketSegmentIdFilters()
Remove all filters.
static const char * version()
Returns Handler&#39;s version.
FilteringTraits::SecurityIdFilters SecurityIdFilters
void registerWarningListener(WarningListener *listener)
Definition: EobiHandler.cpp:67
Enum
Defines the state that the handler is in.
EobiListenerHolder & listenerHolder()
Returns commons services as shared object.
void removeAllPartitionIdFilters()
Remove all filters.
virtual ~EobiHandler()
Finalizes the Handler.
Definition: EobiHandler.cpp:54
void removeAllSecurityIdFilters()
Remove all filters.
void setMarketSegmentIdFilters(const MarketSegmentIdFilters &filters)
void registerSnapshotListener(SnapshotListener *listener)
void registerPacketListener(PacketListener *listener)
HandlerState::Enum state() const
Returns handler state.