コード例 #1
0
ファイル: Core.cs プロジェクト: TMVector/P4ToCSharp
            //T packet_in.lookahead<T>()
            //{
            //  bitsToExtract = sizeof(T);
            //  lastBitNeeded = this.nextBitIndex + bitsToExtract;
            //  ParserModel.verify(this.lengthInBits >= lastBitNeeded, error.PacketTooShort);
            //  T tmp = this.data.extractBits(this.nextBitIndex, bitsToExtract);
            //  return tmp;
            //}


            public void advance(bit32 sizeInBits)
            {
                var lastBitNeeded = bitOffset + sizeInBits.Value;

                verify(data.Length * 8 >= lastBitNeeded, error.PacketTooShort);
                bitOffset += sizeInBits.Value;
            }
コード例 #2
0
ファイル: Core.cs プロジェクト: TMVector/P4ToCSharp
            //void packet_in.extract<T>(out T headerLValue) // NOTE: I am working on the assumption this should actually be `inout`
            //{
            //  //ParserModel.verify(!headerLValue.valid$, error.OverwritingHeader); // Removed
            //  bitsToExtract = sizeofInBits(headerLValue);
            //  lastBitNeeded = this.nextBitIndex + bitsToExtract;
            //  ParserModel.verify(this.lengthInBits >= lastBitNeeded, error.PacketTooShort);
            //  headerLValue = this.data.extractBits(this.nextBitIndex, bitsToExtract);
            //  headerLValue.valid$ = true;
            //  if headerLValue.isNext$ {
            //    verify(headerLValue.nextIndex$ < headerLValue.size, error.StackOutOfBounds);
            //    headerLValue.nextIndex$ = headerLValue.nextIndex$ +1;
            //  }
            //  this.nextBitIndex += bitsToExtract;
            //}

            public void extract <T>(out T variableSizeHeader, bit32 variableFieldSizeInBits)
            {
                throw new NotImplementedException();
            }