#define _DISABLE_EXTENDED_ALIGNED_STORAGE #include "Co2TestInstrument.h" #include "lib/md/MemorySegmentUtils.h" namespace bts { namespace md { Co2TestInstrument::Co2TestInstrument(const std::string& symbol, SecurityType type): _cold_buffer(), _cold(nullptr), _hot(std::make_shared()), _cheader(std::make_shared()), _hheader(std::make_shared()) { _cheader->has_depth = enable_depth(symbol, type); with_security(type, 4, nullptr, [&](FixedSecurity& fsec) { fsec.exchange = api::VENUE_BTS; _cold_buffer = std::shared_ptr(new uint8_t[ColdEntry::fixed_size() + fsec.size], std::default_delete()); _cold = new (_cold_buffer.get()) ColdEntry(fsec.size); memcpy(&_cold->security, &fsec, fsec.size); }); } Co2TestInstrument::Co2TestInstrument(const Security& security, std::shared_ptr cheader, std::shared_ptr hheader): _cold(nullptr), _hot(std::make_shared()), _cheader(cheader), _hheader(hheader) { bts_assert_d(_cheader->has_depth == false); //_cheader->has_depth = enable_depth(md::SecurityHelper::symbol(security), security.security_type()); with_security_like(security, [&](FixedSecurity& fsec) { convert_security(security, fsec, false); _cold_buffer = std::shared_ptr(new uint8_t[ColdEntry::fixed_size() + fsec.size], std::default_delete()); _cold = new (_cold_buffer.get()) ColdEntry(fsec.size); memcpy(&_cold->security, &fsec, fsec.size); }); } MDProducerHandle Co2TestInstrument::producer() { return MDProducerHandle(*_cheader, *_hheader, *_cold, _hot.get(), MDProducerChannel()); } MDConsumerHandle Co2TestInstrument::consumer() { MDConsumerHandle handle; handle.init(*_cheader, *_cold, _hot.get(), nullptr/*mbo*/); return handle; } Co2TestInstrument::~Co2TestInstrument() { } }}//namespace