CppTrader  1.0.4.0
C++ Trader
market_manager.inl
Go to the documentation of this file.
1 
9 namespace CppTrader {
10 namespace Matching {
11 
13  : MarketManager(_default)
14 {
15 }
16 
18  : _market_handler(market_handler),
19  _auxiliary_memory_manager(),
20  _level_memory_manager(_auxiliary_memory_manager),
21  _level_pool(_level_memory_manager),
22  _symbol_memory_manager(_auxiliary_memory_manager),
23  _symbol_pool(_symbol_memory_manager),
24  _order_book_memory_manager(_auxiliary_memory_manager),
25  _order_book_pool(_order_book_memory_manager),
26  _order_memory_manager(_auxiliary_memory_manager),
27  _order_pool(_order_memory_manager),
28  _orders(16384, 0),
29  _matching(false)
30 {
31 
32 }
33 
34 inline const Symbol* MarketManager::GetSymbol(uint32_t id) const noexcept
35 {
36  return ((id < _symbols.size()) ? _symbols[id] : nullptr);
37 }
38 
39 inline const OrderBook* MarketManager::GetOrderBook(uint32_t id) const noexcept
40 {
41  return ((id < _order_books.size()) ? _order_books[id] : nullptr);
42 }
43 
44 inline const Order* MarketManager::GetOrder(uint64_t id) const noexcept
45 {
46  assert((id > 0) && "Order Id must be greater than zero!");
47  if (id == 0)
48  return nullptr;
49 
50  auto it = _orders.find(id);
51  return ((it != _orders.end()) ? it->second : nullptr);
52 }
53 
54 } // namespace Matching
55 } // namespace CppTrader
const OrderBook * GetOrderBook(uint32_t id) const noexcept
Get the order book for the given symbol Id.
const Order * GetOrder(uint64_t id) const noexcept
Get the order with the given Id.
const Symbol * GetSymbol(uint32_t id) const noexcept
Get the symbol with the given Id.
C++ Trader project definitions.
Definition: errors.h:16