@@ -254,36 +254,68 @@ using Bbo1MMsg = BboMsg;
254254static_assert (alignof (BboMsg) == 8 , " Must have 8-byte alignment" );
255255static_assert (sizeof (BboMsg) == sizeof (Mbp1Msg), " BboMsg size must match Rust" );
256256
257+ struct Cmbp1Msg {
258+ static bool HasRType (RType rtype) {
259+ switch (rtype) {
260+ case RType::Cmbp1: // fallthrough
261+ case RType::Tcbbo:
262+ return true ;
263+ default :
264+ return false ;
265+ };
266+ }
267+
268+ UnixNanos IndexTs () const { return ts_recv; }
269+
270+ RecordHeader hd;
271+ std::int64_t price;
272+ std::uint32_t size;
273+ char action;
274+ Side side;
275+ FlagSet flags;
276+ char reserved1;
277+ UnixNanos ts_recv;
278+ TimeDeltaNanos ts_in_delta;
279+ std::array<char , 4 > reserved2;
280+ std::array<ConsolidatedBidAskPair, 1 > levels;
281+ };
282+ using TcbboMsg = Cmbp1Msg;
283+ static_assert (alignof (Cmbp1Msg) == 8 , " Must have 8-byte alignment" );
284+ static_assert (sizeof (Cmbp1Msg) ==
285+ sizeof (TradeMsg) + sizeof (ConsolidatedBidAskPair),
286+ " Cmbp1Msg size must match Rust" );
287+
257288struct CbboMsg {
258289 static bool HasRType (RType rtype) {
259290 switch (rtype) {
260- case RType::Cbbo: // fallthrough
261291 case RType::Cbbo1S: // fallthrough
262292 case RType::Cbbo1M: // fallthrough
263- case RType::Tcbbo:
264293 return true ;
265294 default :
266295 return false ;
267296 };
268297 }
298+ static_assert (alignof (Cmbp1Msg) == 8 , " Must have 8-byte alignment" );
299+ static_assert (sizeof (Cmbp1Msg) ==
300+ sizeof (TradeMsg) + sizeof (ConsolidatedBidAskPair),
301+ " Cmbp1Msg size must match Rust" );
269302
270303 UnixNanos IndexTs () const { return ts_recv; }
271304
272305 RecordHeader hd;
273306 std::int64_t price;
274307 std::uint32_t size;
275- Action action ;
308+ char reserved1 ;
276309 Side side;
277310 FlagSet flags;
278- char reserved ;
311+ char reserved2 ;
279312 UnixNanos ts_recv;
280- TimeDeltaNanos ts_in_delta ;
281- std::uint32_t sequence ;
313+ std::array< char , 4 > reserved3 ;
314+ std::array< char , 4 > reserved4 ;
282315 std::array<ConsolidatedBidAskPair, 1 > levels;
283316};
284317using Cbbo1SMsg = CbboMsg;
285318using Cbbo1MMsg = CbboMsg;
286- using TcbboMsg = CbboMsg;
287319static_assert (alignof (CbboMsg) == 8 , " Must have 8-byte alignment" );
288320static_assert (sizeof (CbboMsg) ==
289321 sizeof (TradeMsg) + sizeof (ConsolidatedBidAskPair),
@@ -604,12 +636,20 @@ inline bool operator!=(const BboMsg& lhs, const BboMsg& rhs) {
604636 return !(lhs == rhs);
605637}
606638
607- inline bool operator ==(const CbboMsg & lhs, const CbboMsg & rhs) {
639+ inline bool operator ==(const Cmbp1Msg & lhs, const Cmbp1Msg & rhs) {
608640 return lhs.hd == rhs.hd && lhs.price == rhs.price && lhs.size == rhs.size &&
609641 lhs.action == rhs.action && lhs.side == rhs.side &&
610642 lhs.flags == rhs.flags && lhs.ts_recv == rhs.ts_recv &&
611- lhs.ts_in_delta == rhs.ts_in_delta && lhs.sequence == rhs.sequence &&
612- lhs.levels == rhs.levels ;
643+ lhs.ts_in_delta == rhs.ts_in_delta && lhs.levels == rhs.levels ;
644+ }
645+ inline bool operator !=(const Cmbp1Msg& lhs, const Cmbp1Msg& rhs) {
646+ return !(lhs == rhs);
647+ }
648+
649+ inline bool operator ==(const CbboMsg& lhs, const CbboMsg& rhs) {
650+ return lhs.hd == rhs.hd && lhs.price == rhs.price && lhs.size == rhs.size &&
651+ lhs.side == rhs.side && lhs.flags == rhs.flags &&
652+ lhs.ts_recv == rhs.ts_recv && lhs.levels == rhs.levels ;
613653}
614654inline bool operator !=(const CbboMsg& lhs, const CbboMsg& rhs) {
615655 return !(lhs == rhs);
0 commit comments