Go to the documentation of this file.
15 #ifndef GRPC_EVENT_ENGINE_SLICE_BUFFER_H
16 #define GRPC_EVENT_ENGINE_SLICE_BUFFER_H
29 #include "absl/strings/string_view.h"
30 #include "absl/utility/utility.h"
33 namespace experimental {
55 : slice_buffer_(other.slice_buffer_) {
122 return internal::SliceCast<Slice>(slice_buffer_.
slices[index]);
127 return internal::SliceCast<Slice>(slice_buffer_.
slices[index]);
156 #endif // GRPC_EVENT_ENGINE_SLICE_BUFFER_H
static SliceBuffer TakeCSliceBuffer(grpc_slice_buffer &slice_buffer)
Definition: slice_buffer.h:138
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:70
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:86
const Slice & operator[](size_t index) const
Array access into the SliceBuffer.
Definition: slice_buffer.h:121
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:134
size_t count
the number of slices in the array
Definition: slice_type.h:88
void Clear()
Removes and unrefs all slices in the SliceBuffer.
Definition: slice_buffer.h:107
A Wrapper around grpc_slice_buffer pointer.
Definition: slice_buffer.h:50
void RemoveLastNBytes(size_t n)
Removes/deletes the last n bytes in the SliceBuffer.
Definition: slice_buffer.h:86
SliceBuffer & operator=(const SliceBuffer &)=delete
size_t length
the combined length of all slices in the array
Definition: slice_type.h:93
void MoveFirstNBytesIntoSliceBuffer(size_t n, SliceBuffer &other)
Move the first n bytes of the SliceBuffer into the other SliceBuffer.
Definition: slice_buffer.h:102
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:131
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:126
size_t Count()
Returns the number of slices held by the SliceBuffer.
Definition: slice_buffer.h:83
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:91
SliceBuffer & operator=(SliceBuffer &&other) noexcept
Definition: slice_buffer.h:64
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:54
~SliceBuffer()
Upon destruction, the underlying raw slice buffer is cleaned out and all slices are unreffed.
Definition: slice_buffer.h:61
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice_type.h:80
SliceBuffer()
Definition: slice_buffer.h:52
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:97