|
Leka
A low-latency C++20 price-time-priority limit order book and matching engine
|
Type-safe event-first command for the matching engine. More...
#include <order_event.hpp>
Public Member Functions | |
| OrderEvent (NewOrder order) | |
| Creates a NEW event. | |
| OrderEvent (CancelOrder order) | |
| Creates a CANCEL event. | |
| OrderEvent (ReduceOrder order) | |
| Creates a REDUCE event. | |
| OrderEventType | getEventType () const |
| Returns the operation represented by the active payload. | |
| const NewOrder & | getNewOrder () const |
| Returns the NEW payload or throws when this is not a NEW event. | |
| const CancelOrder & | getCancelOrder () const |
| Returns the CANCEL payload or throws when this is not a CANCEL event. | |
| const ReduceOrder & | getReduceOrder () const |
| Returns the REDUCE payload or throws when this is not a REDUCE event. | |
Type-safe event-first command for the matching engine.
The active payload determines which fields are relevant. Accessing a payload for a different event type throws std::logic_error.
Definition at line 77 of file order_event.hpp.
|
explicit |
Creates a NEW event.
Constructs a NEW event from its payload.
Definition at line 14 of file order_event.cpp.
|
explicit |
Creates a CANCEL event.
Constructs a CANCEL event from its payload.
Definition at line 17 of file order_event.cpp.
|
explicit |
Creates a REDUCE event.
Constructs a REDUCE event from its payload.
Definition at line 20 of file order_event.cpp.
| OrderEventType lob::OrderEvent::getEventType | ( | ) | const |
Returns the operation represented by the active payload.
Returns the variant index corresponding to the event operation.
Definition at line 23 of file order_event.cpp.
Referenced by lob::MatchingEngine::processEvent().
| const NewOrder & lob::OrderEvent::getNewOrder | ( | ) | const |
Returns the NEW payload or throws when this is not a NEW event.
The accessors test the active alternative once through get_if rather than pairing holds_alternative with get, which would discriminate the variant twice on every dispatched event.
Definition at line 32 of file order_event.cpp.
| const CancelOrder & lob::OrderEvent::getCancelOrder | ( | ) | const |
Returns the CANCEL payload or throws when this is not a CANCEL event.
Returns the CANCEL payload after checking the active event type.
Definition at line 41 of file order_event.cpp.
Referenced by lob::MatchingEngine::processEvent().
| const ReduceOrder & lob::OrderEvent::getReduceOrder | ( | ) | const |
Returns the REDUCE payload or throws when this is not a REDUCE event.
Returns the REDUCE payload after checking the active event type.
Definition at line 50 of file order_event.cpp.