#include <slice.h>
Public Types | |
enum | AddRef { ADD_REF } |
enum | StaticSlice { STATIC_SLICE } |
enum | StealRef { STEAL_REF } |
Public Member Functions | |
const uint8_t * | begin () const |
Raw pointer to the beginning (first element) of the slice. More... | |
grpc_slice | c_slice () const |
Raw C slice. Caller needs to call grpc_slice_unref when done. More... | |
const uint8_t * | end () const |
Raw pointer to the end (one byte past the last element) of the slice. More... | |
Slice & | operator= (Slice other) |
Assignment, reference count is unchanged. More... | |
size_t | size () const |
Byte size. More... | |
Slice () | |
Construct an empty slice. More... | |
Slice (const Slice &other) | |
Copy constructor, adds a reference. More... | |
Slice (const std::string &str) | |
Construct a slice from a copied string. More... | |
Slice (const void *buf, size_t len) | |
Construct a slice from a copied buffer. More... | |
Slice (const void *buf, size_t len, StaticSlice) | |
Construct a slice from a static buffer. More... | |
Slice (grpc_slice slice, AddRef) | |
Construct a slice from slice, adding a reference. More... | |
Slice (grpc_slice slice, StealRef) | |
Construct a slice from slice, stealing a reference. More... | |
Slice (size_t len) | |
Allocate a slice of specified size. More... | |
Slice (Slice &&other) noexcept | |
Move constructor, steals a reference. More... | |
Slice (void *buf, size_t len, void(*destroy)(void *)) | |
Specialization of above for common case where buf == user_data. More... | |
Slice (void *buf, size_t len, void(*destroy)(void *), void *user_data) | |
Slice (void *buf, size_t len, void(*destroy)(void *, size_t)) | |
Similar to the above but has a destroy that also takes slice length. More... | |
Slice | sub (size_t begin, size_t end) const |
Returns a substring of the slice as another slice. More... | |
~Slice () | |
Destructor - drops one reference. More... | |
Private Attributes | |
grpc_slice | slice_ |
Friends | |
class | ByteBuffer |
A wrapper around grpc_slice.
A slice represents a contiguous reference counted array of bytes. It is cheap to take references to a slice, and it is cheap to create a slice pointing to a subset of another slice.
Definition at line 36 of file include/grpcpp/impl/codegen/slice.h.
enum grpc::Slice::AddRef |
Enumerator | |
---|---|
ADD_REF |
Definition at line 43 of file include/grpcpp/impl/codegen/slice.h.
Enumerator | |
---|---|
STATIC_SLICE |
Definition at line 67 of file include/grpcpp/impl/codegen/slice.h.
Enumerator | |
---|---|
STEAL_REF |
Definition at line 48 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Construct an empty slice.
Definition at line 39 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Destructor - drops one reference.
Definition at line 41 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Construct a slice from slice, adding a reference.
Definition at line 45 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Construct a slice from slice, stealing a reference.
Definition at line 50 of file include/grpcpp/impl/codegen/slice.h.
|
inlineexplicit |
Allocate a slice of specified size.
Definition at line 53 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Construct a slice from a copied buffer.
Definition at line 57 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Construct a slice from a copied string.
Definition at line 63 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Construct a slice from a static buffer.
Definition at line 70 of file include/grpcpp/impl/codegen/slice.h.
Copy constructor, adds a reference.
Definition at line 75 of file include/grpcpp/impl/codegen/slice.h.
|
inlinenoexcept |
Move constructor, steals a reference.
Definition at line 79 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Create a slice pointing at some data. Calls malloc to allocate a refcount for the object, and arranges that destroy will be called with the user data pointer passed in at destruction. Can be the same as buf or different (e.g., if data is part of a larger structure that must be destroyed when the data is no longer needed)
Definition at line 94 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Specialization of above for common case where buf == user_data.
Definition at line 99 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Similar to the above but has a destroy that also takes slice length.
Definition at line 103 of file include/grpcpp/impl/codegen/slice.h.
Raw pointer to the beginning (first element) of the slice.
Definition at line 111 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Raw C slice. Caller needs to call grpc_slice_unref when done.
Definition at line 123 of file include/grpcpp/impl/codegen/slice.h.
Raw pointer to the end (one byte past the last element) of the slice.
Definition at line 114 of file include/grpcpp/impl/codegen/slice.h.
Assignment, reference count is unchanged.
Definition at line 84 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Byte size.
Definition at line 108 of file include/grpcpp/impl/codegen/slice.h.
|
inline |
Returns a substring of the slice
as another slice.
Definition at line 117 of file include/grpcpp/impl/codegen/slice.h.
|
friend |
Definition at line 128 of file include/grpcpp/impl/codegen/slice.h.
|
private |
Definition at line 130 of file include/grpcpp/impl/codegen/slice.h.