public void WrapForDecode(NewOrderCross parentMessage, DirectBuffer buffer, int actingVersion) { _parentMessage = parentMessage; _buffer = buffer; _dimensions.Wrap(buffer, parentMessage.Limit, actingVersion); _blockLength = _dimensions.BlockLength; _count = (int)_dimensions.NumInGroup; _actingVersion = actingVersion; _index = 0; _parentMessage.Limit = parentMessage.Limit + SbeHeaderSize; }
public void WrapForEncode(NewOrderCross parentMessage, DirectBuffer buffer, int count) { if ((uint)count > 254) { ThrowHelper.ThrowCountOutOfRangeException(count); } _parentMessage = parentMessage; _buffer = buffer; _dimensions.Wrap(buffer, parentMessage.Limit, _actingVersion); _dimensions.BlockLength = SbeBlockLength; _dimensions.NumInGroup = (byte)count; _index = 0; _count = count; _blockLength = SbeBlockLength; _actingVersion = SchemaVersion; parentMessage.Limit = parentMessage.Limit + SbeHeaderSize; }
public static void Decode(NewOrderCross sno, DirectBuffer directBuffer, int bufferOffset, int actingBlockLength, int actingVersion) { var buffer = new byte[128]; var sb = new StringBuilder(); // position the car flyweight just after the header on the DirectBuffer sno.WrapForDecode(directBuffer, bufferOffset, actingBlockLength, actingVersion); NewOrderCross.NoSidesGroup g = sno.NoSides; while (g.HasNext) { g.Next(); Console.WriteLine(g.Account); Console.WriteLine(g.ClOrdID); Console.WriteLine(g.Side); } Console.WriteLine(sb.ToString()); }
public static int Encode(NewOrderCross sno, DirectBuffer directBuffer, int bufferOffset) { // we position the car encoder on the direct buffer, at the correct offset (ie. just after the header) sno.WrapForEncode(directBuffer, bufferOffset); sno.SecurityID = 48; sno.OrderQty = 100; sno.MarketSegmentID = 70; sno.Price.Mantissa = 11; NewOrderCross.NoSidesGroup g = sno.NoSidesCount(2); g.Next(); g.Account = 1111; g.ClOrdID = 1234; g.Side = Side.BUY; g.Next(); g.Account = 2222; g.ClOrdID = 5678; g.Side = Side.SELL; Negotiate n = new Negotiate(); n.Timestamp.Time = 1123; return(sno.Size); }
public NewOrderCross() { _parentMessage = this; }