class SliceBuffer

Defined at line 52 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

A Wrapper around

pointer.

A slice buffer holds the memory for a collection of slices.

The SliceBuffer object itself is meant to only hide the C-style API,

and won't hold the data itself. In terms of lifespan, the

grpc_slice_buffer ought to be kept somewhere inside the caller's objects,

like a transport or an endpoint.

This lifespan rule is likely to change in the future, as we may

collapse the grpc_slice_buffer structure straight into this class.

The SliceBuffer API is basically a replica of the grpc_slice_buffer's,

and its documentation will move here once we remove the C structure,

which should happen before the EventEngine's API is no longer

an experimental API.

Public Methods

void Append (Slice slice)

Appends a new slice into the SliceBuffer and makes an attempt to merge

this slice with the last slice in the SliceBuffer.

size_t AppendIndexed (Slice slice)

Adds a new slice into the SliceBuffer at the next available index.

Returns the index at which the new slice is added.

void SliceBuffer ()

Defined at line 54 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void SliceBuffer (const SliceBuffer & other)

Defined at line 55 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void SliceBuffer (SliceBuffer && other)

Defined at line 56 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void ~SliceBuffer ()

Upon destruction, the underlying raw slice buffer is cleaned out and all

slices are unreffed.

Defined at line 63 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

SliceBuffer & operator= (const SliceBuffer & )

Defined at line 65 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

SliceBuffer & operator= (SliceBuffer && other)

Defined at line 66 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void Swap (SliceBuffer & other)

Swap the contents of this SliceBuffer with the contents of another.

Defined at line 72 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

size_t Count ()

Returns the number of slices held by the SliceBuffer.

Defined at line 85 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void RemoveLastNBytes (size_t n)

Removes/deletes the last n bytes in the SliceBuffer.

Defined at line 88 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void MoveFirstNBytesIntoBuffer (size_t n, void * dst)

Move the first n bytes of the SliceBuffer into a memory pointed to by dst.

Defined at line 93 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void MoveLastNBytesIntoSliceBuffer (size_t n, SliceBuffer & other)

Removes/deletes the last n bytes in the SliceBuffer and add it to the

other SliceBuffer

Defined at line 99 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void MoveFirstNBytesIntoSliceBuffer (size_t n, SliceBuffer & other)

Move the first n bytes of the SliceBuffer into the other SliceBuffer

Defined at line 104 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

void Clear ()

Removes and unrefs all slices in the SliceBuffer.

Defined at line 109 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

Slice TakeFirst ()

Removes the first slice in the SliceBuffer and returns it.

void Prepend (Slice slice)

Prepends the slice to the the front of the SliceBuffer.

Slice RefSlice (size_t index)

Increased the ref-count of slice at the specified index and returns the

associated slice.

const Slice & operator[] (size_t index)

Array access into the SliceBuffer. It returns a non mutable reference to

the slice at the specified index

Defined at line 123 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

Slice & MutableSliceAt (size_t index)

Return mutable reference to the slice at the specified index

Defined at line 128 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

size_t Length ()

The total number of bytes held by the SliceBuffer

Defined at line 133 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

grpc_slice_buffer * c_slice_buffer ()

Return a pointer to the back raw grpc_slice_buffer

Defined at line 136 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h

SliceBuffer TakeCSliceBuffer (grpc_slice_buffer & slice_buffer)

Returns a SliceBuffer that transfers slices into this new SliceBuffer,

leaving the input parameter empty.

Defined at line 140 of file ../../third_party/grpc-migrating/src/include/grpc/event_engine/slice_buffer.h