Go to the documentation of this file.
15 #ifndef GRPC_EVENT_ENGINE_SLICE_BUFFER_H
16 #define GRPC_EVENT_ENGINE_SLICE_BUFFER_H
23 #include "absl/strings/string_view.h"
24 #include "absl/utility/utility.h"
35 namespace experimental {
57 : slice_buffer_(other.slice_buffer_) {
124 return internal::SliceCast<Slice>(slice_buffer_.
slices[index]);
129 return internal::SliceCast<Slice>(slice_buffer_.
slices[index]);
158 #endif // GRPC_EVENT_ENGINE_SLICE_BUFFER_H
static SliceBuffer TakeCSliceBuffer(grpc_slice_buffer &slice_buffer)
Definition: slice_buffer.h:140
GPRAPI void grpc_slice_buffer_destroy(grpc_slice_buffer *sb)
destroy a slice buffer - unrefs any held elements
void Swap(SliceBuffer &other)
Swap the contents of this SliceBuffer with the contents of another.
Definition: slice_buffer.h:72
void Append(Slice slice)
Appends a new slice into the SliceBuffer and makes an attempt to merge this slice with the last slice...
Slice RefSlice(size_t index)
Increased the ref-count of slice at the specified index and returns the associated slice.
size_t AppendIndexed(Slice slice)
Adds a new slice into the SliceBuffer at the next available index.
grpc_slice * slices
slices in the array (Points to the first valid grpc_slice in the array)
Definition: slice_type.h:87
const Slice & operator[](size_t index) const
Array access into the SliceBuffer.
Definition: slice_buffer.h:123
GPRAPI void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *dst)
move the first n bytes of src into dst
grpc_slice_buffer * c_slice_buffer()
Return a pointer to the back raw grpc_slice_buffer.
Definition: slice_buffer.h:136
size_t count
the number of slices in the array
Definition: slice_type.h:89
void Clear()
Removes and unrefs all slices in the SliceBuffer.
Definition: slice_buffer.h:109
A Wrapper around grpc_slice_buffer pointer.
Definition: slice_buffer.h:52
void RemoveLastNBytes(size_t n)
Removes/deletes the last n bytes in the SliceBuffer.
Definition: slice_buffer.h:88
SliceBuffer & operator=(const SliceBuffer &)=delete
size_t length
the combined length of all slices in the array
Definition: slice_type.h:94
void MoveFirstNBytesIntoSliceBuffer(size_t n, SliceBuffer &other)
Move the first n bytes of the SliceBuffer into the other SliceBuffer.
Definition: slice_buffer.h:104
GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb)
clear a slice buffer, unref all elements
size_t Length() const
The total number of bytes held by the SliceBuffer.
Definition: slice_buffer.h:133
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb)
initialize a slice buffer
GPRAPI void grpc_slice_buffer_trim_end(grpc_slice_buffer *sb, size_t n, grpc_slice_buffer *garbage)
remove n bytes from the end of a slice buffer
Slice & MutableSliceAt(size_t index) const
Return mutable reference to the slice at the specified index.
Definition: slice_buffer.h:128
size_t Count()
Returns the number of slices held by the SliceBuffer.
Definition: slice_buffer.h:85
Definition: endpoint_config.h:24
void MoveFirstNBytesIntoBuffer(size_t n, void *dst)
Move the first n bytes of the SliceBuffer into a memory pointed to by dst.
Definition: slice_buffer.h:93
SliceBuffer & operator=(SliceBuffer &&other) noexcept
Definition: slice_buffer.h:66
GPRAPI void grpc_slice_buffer_move_first_into_buffer(grpc_slice_buffer *src, size_t n, void *dst)
move the first n bytes of src into dst (copying them)
Slice TakeFirst()
Removes the first slice in the SliceBuffer and returns it.
SliceBuffer(SliceBuffer &&other) noexcept
Definition: slice_buffer.h:56
~SliceBuffer()
Upon destruction, the underlying raw slice buffer is cleaned out and all slices are unreffed.
Definition: slice_buffer.h:63
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice_type.h:81
SliceBuffer()
Definition: slice_buffer.h:54
void Prepend(Slice slice)
Prepends the slice to the the front of the SliceBuffer.
GPRAPI void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b)
swap the contents of two slice buffers
void MoveLastNBytesIntoSliceBuffer(size_t n, SliceBuffer &other)
Removes/deletes the last n bytes in the SliceBuffer and add it to the other SliceBuffer.
Definition: slice_buffer.h:99