20 #include <boost/function.hpp> 44 #include <boost/bind.hpp> 48 ONIXS_HANDLER_NAMESPACE_BEGIN
50 ListenerHolder::ListenerHolder (
const OnixS::Logging::LogFacility* parent, HandlerLogger* logger)
51 : base(
"ListenerHolder", parent,
OnixS::Logging::LOG_LEVEL_DEBUG)
53 , errorListener_(nullptr)
54 , warningListener_(nullptr)
55 , handlerStateListener_(nullptr)
56 , messageListener_(nullptr)
57 , timeListener_(nullptr)
58 , referenceDataListener_(nullptr)
59 , systemEventListener_(nullptr)
60 , orderListener_(nullptr)
61 , tradeListener_(nullptr)
62 , auctionListener_(nullptr)
63 , orderBookListener_(nullptr)
69 BOOST_ASSERT(handlerLogger !=
nullptr);
70 logger_ = handlerLogger;
87 const std::string& description) ONIXS_NOEXCEPT
106 if (messageListener_ !=
nullptr)
114 if (messageListener_ !=
nullptr)
123 BOOST_ASSERT(msg !=
nullptr);
125 if (timeListener_ !=
nullptr)
134 BOOST_ASSERT(msg !=
nullptr);
136 if (referenceDataListener_ !=
nullptr)
145 BOOST_ASSERT(msg !=
nullptr);
147 if (referenceDataListener_ !=
nullptr)
156 BOOST_ASSERT(msg !=
nullptr);
158 if (referenceDataListener_ !=
nullptr)
167 BOOST_ASSERT(msg !=
nullptr);
169 if (systemEventListener_ !=
nullptr)
178 BOOST_ASSERT(msg !=
nullptr);
180 if (systemEventListener_ !=
nullptr)
189 BOOST_ASSERT(msg !=
nullptr);
191 if (orderListener_ !=
nullptr)
200 BOOST_ASSERT(msg !=
nullptr);
202 if (orderListener_ !=
nullptr)
211 BOOST_ASSERT(msg !=
nullptr);
213 if (orderListener_ !=
nullptr)
222 BOOST_ASSERT(msg !=
nullptr);
224 if (orderListener_ !=
nullptr)
233 BOOST_ASSERT(msg !=
nullptr);
235 if (orderListener_ !=
nullptr)
244 BOOST_ASSERT(msg !=
nullptr);
246 if (tradeListener_ !=
nullptr)
255 BOOST_ASSERT(msg !=
nullptr);
257 if (tradeListener_ !=
nullptr)
266 if (orderBookListener_ !=
nullptr)
274 if (orderBookListener_ !=
nullptr)
282 if (messageListener_ !=
nullptr)
290 if (messageListener_ !=
nullptr)
298 if (messageListener_ !=
nullptr)
304 void ListenerHolder::reportError(
const std::string& description)
306 logger_->log(ONIXS_LOG_DEBUG[
this] << description);
309 ONIXS_HANDLER_NAMESPACE_END
void invokeOrderExecutedWithPrice(const OrderExecutedWithPriceMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeAddOrder(const AddOrderMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeInactivity() ONIXS_NOEXCEPT
void invokeGap(SequenceNumber expectedSeqNum, SequenceNumber receivedSeqNum) ONIXS_NOEXCEPT
virtual void onOrderBookState(const OrderBookStateMsg &msg, const DataSource &dataSource)=0
Is invoked when OrderBookStateMsg received.
virtual void onSystemEvent(const SystemEventMsg &msg, const DataSource &dataSource)=0
Is invoked when SystemEventMsg received.
void invokeOrderReplace(const OrderReplaceMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeOrderBookState(const OrderBookStateMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
UInt64 SequenceNumber
Alias for Sequence Number type.
void invokeSnapshotRecoveryFinished() ONIXS_NOEXCEPT
virtual void onOrderExecutedWithPrice(const OrderExecutedWithPriceMsg &msg, const DataSource &dataSource)=0
Is invoked when OrderExecutedWithPriceMsg received.
void invokeEquilibriumPriceUpdate(const EquilibriumPriceUpdateMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
virtual void onOrderReplace(const OrderReplaceMsg &msg, const DataSource &dataSource)=0
Is invoked when OrderReplaceMsg received.
void invokeOrderBookUpdated(const OrderBookInternal &book) ONIXS_NOEXCEPT
virtual void onEquilibriumPriceUpdate(const EquilibriumPriceUpdateMsg &msg, const DataSource &dataSource)=0
Is invoked when TradeMsg received.
void invokeOrderBookDirectory(const OrderBookDirectoryMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeOrderBookOutOfDate(const OrderBookInternal &book) ONIXS_NOEXCEPT
virtual void onOrderExecuted(const OrderExecutedMsg &msg, const DataSource &dataSource)=0
Is invoked when OrderExecutedMsg received.
void invokeTime(const SecondsMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
Enum
Defines the state that the handler is in.
virtual void onOrderBookDirectory(const OrderBookDirectoryMsg &msg, const DataSource &dataSource)=0
Is invoked when OrderBookDirectoryMsg received.
virtual void onSnapshotRecoveryFinished()=0
is invoked when snapshot recovery finished
void invokeEndOfSession() ONIXS_NOEXCEPT
virtual void onEndOfSession()=0
is invoking when end of session event received
void setLogger(HandlerCore::Common::HandlerLogger *handlerLogger)
virtual void onOrderDelete(const OrderDeleteMsg &msg, const DataSource &dataSource)=0
Is invoked when OrderDeleteMsg received.
void invokeOrderDelete(const OrderDeleteMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeSnapshotRecoveryStarted() ONIXS_NOEXCEPT
virtual void onAddOrder(const AddOrderMsg &msg, const DataSource &dataSource)=0
Is invoked when AddOrderMsg received.
virtual void onOrderBookUpdated(const OrderBook &book)=0
Is called when the book is updated.
void invokeTrade(const TradeMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeWarning(const std::string &description) ONIXS_NOEXCEPT
virtual void onInactivity()=0
is invoking when inactivity happens
virtual void onSnapshotRecoveryStarted()=0
is invoked when snapshot recovery started
void invokeStateChanged(HandlerState::Enum newState) ONIXS_NOEXCEPT
virtual void onSeconds(const SecondsMsg &time, const DataSource &dataSource)=0
void invokeOrderExecuted(const OrderExecutedMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
virtual void onCombinationOrderBookLeg(const CombinationOrderBookLegMsg &msg, const DataSource &dataSource)=0
Is invoked when CombinationOrderBookLegMsg received.
void invokeCombinationOrderBookLeg(const CombinationOrderBookLegMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
virtual void onOrderBookOutOfDate(const OrderBook &book)=0
virtual void onTickSizeTableEntry(const TickSizeTableEntryMsg &msg, const DataSource &dataSource)=0
Is invoked when TickSizeTableEntryMsg received.
void invokeTickSizeTableEntry(const TickSizeTableEntryMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
void invokeError(ErrorCode::Enum code, const std::string &description) ONIXS_NOEXCEPT
#define ONIXS_EXCEPTION_TRACED_CALLBACK(callback, contextName)
virtual void onGap(SequenceNumber expectedSeqNum, SequenceNumber receivedSeqNum)=0
is invoke when Gap happens
virtual void onTrade(const TradeMsg &msg, const DataSource &dataSource)=0
Is invoked when TradeMsg received.
void invokeSystemEvent(const SystemEventMsg *msg, const DataSource &dataSource) ONIXS_NOEXCEPT
Enum
Known (selected) error codes.