Fix copy constructor and c# MDConsumerHandle blit code
This commit is contained in:
1 parent
97ef233dfe
commit
6d256ffa7f
3 files changed
+16
-25
No files matched your search
@@ -36,6 +36,7 @@ namespace mbts.co2
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct BlitPointerTuple
|
||||
{
|
||||
private readonly IntPtr type;
|
||||
public readonly IntPtr hot;
|
||||
public readonly IntPtr cold_data;
|
||||
public readonly IntPtr cold_header;
|
||||
|
||||
@@ -15,7 +15,7 @@ MDConsumerHandle::MDConsumerHandle()
|
||||
}
|
||||
|
||||
MDConsumerHandle::MDConsumerHandle(const MDConsumerHandle& other) :
|
||||
_type(other._type)
|
||||
_type(HANDLETYPE_VOID)
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
@@ -23,18 +23,8 @@ MDConsumerHandle::MDConsumerHandle(const MDConsumerHandle& other) :
|
||||
MDConsumerHandle::~MDConsumerHandle() {}
|
||||
|
||||
void MDConsumerHandle::init(const ColdHeader& cheader, const ColdEntry& centry, const void* pvhot) {
|
||||
if (cheader.has_depth) {
|
||||
_type = HANDLETYPE_DEPTH;
|
||||
book.hot = (HotDepthEntry*)pvhot;
|
||||
book.cdata = ¢ry;
|
||||
book.cheader = &cheader;
|
||||
}
|
||||
else {
|
||||
_type = HANDLETYPE_BBO;
|
||||
bbo.hot = (HotEntry*)pvhot;
|
||||
bbo.cdata = ¢ry;
|
||||
bbo.cheader = &cheader;
|
||||
}
|
||||
set_cold(&cheader, ¢ry);
|
||||
set_hot(pvhot);
|
||||
}
|
||||
|
||||
TimeStamp copy_bbo(const TimeStamp& time, const SingleWriterPriceSizeStore& in_bid, const SingleWriterPriceSizeStore& in_ask, PriceSize& out_bid, PriceSize& out_ask) {
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
|
||||
MDConsumerHandle& operator=(const MDConsumerHandle& other) {
|
||||
_type = HANDLETYPE_VOID;
|
||||
switch(_type) {
|
||||
switch(other._type) {
|
||||
case HANDLETYPE_VOID: break;
|
||||
case HANDLETYPE_DEPTH:
|
||||
book = other.book;
|
||||
@@ -148,7 +148,6 @@ public:
|
||||
private:
|
||||
friend class MDConsumerInst;
|
||||
void set_hot(const void* hot) {
|
||||
bts_assert(!is_synthetic());
|
||||
switch(_type) {
|
||||
case HANDLETYPE_DEPTH:
|
||||
book.hot = (HotDepthEntry*)hot;
|
||||
@@ -161,16 +160,17 @@ private:
|
||||
}
|
||||
}
|
||||
void set_cold(const ColdHeader* header, const ColdEntry* cold) {
|
||||
switch(_type) {
|
||||
case HANDLETYPE_DEPTH:
|
||||
book.cheader = header;
|
||||
book.cdata = cold;
|
||||
break;
|
||||
case HANDLETYPE_BBO:
|
||||
bbo.cheader = header;
|
||||
bbo.cdata = cold;
|
||||
default:
|
||||
bts_assert(false);
|
||||
bts_assert(header != nullptr);
|
||||
bts_assert(cold != nullptr);
|
||||
if (header->has_depth) {
|
||||
book.cheader = header;
|
||||
book.cdata = cold;
|
||||
_type = HANDLETYPE_DEPTH;
|
||||
}
|
||||
else {
|
||||
bbo.cheader = header;
|
||||
bbo.cdata = cold;
|
||||
_type = HANDLETYPE_BBO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user