コード例 #1
0
 public void Advance(int count)
 {
     GrpcPreconditions.CheckArgument(count >= 0);
     GrpcPreconditions.CheckArgument(tailSpacePtr != IntPtr.Zero || count == 0);
     GrpcPreconditions.CheckArgument(tailSpaceLen >= count);
     tailSpaceLen = tailSpaceLen - count;
     tailSpacePtr += count;
     memoryManagerLazy?.Reset();
 }
コード例 #2
0
 // provides access to the "tail space" of this buffer.
 // Use GetSpan when possible for better efficiency.
 public Memory<byte> GetMemory(int sizeHint = 0)
 {
     EnsureBufferSpace(sizeHint);
     if (memoryManagerLazy == null)
     {
         memoryManagerLazy = new SliceMemoryManager();
     }
     memoryManagerLazy.Reset(new Slice(tailSpacePtr, tailSpaceLen));
     return memoryManagerLazy.Memory;
 }
コード例 #3
0
 public void Reset(Slice slice, long runningIndex)
 {
     pointerMemoryManager.Reset(slice);
     Memory       = pointerMemoryManager.Memory; // maybe not always necessary
     RunningIndex = runningIndex;
 }