class Slice
Defined at line 33 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
A wrapper around
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.
Public Methods
void Slice ()
Construct an empty slice.
Defined at line 36 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void ~Slice ()
Destructor - drops one reference.
Defined at line 38 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (grpc_slice slice, AddRef )
Construct a slice from
adding a reference.
Defined at line 42 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (grpc_slice slice, StealRef )
Construct a slice from
stealing a reference.
Defined at line 46 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (size_t len)
Allocate a slice of specified size
Defined at line 49 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (const void * buf, size_t len)
Construct a slice from a copied buffer
Defined at line 52 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (const std::string & str)
Construct a slice from a copied string
NOLINTNEXTLINE(google-explicit-constructor)
Defined at line 58 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (const void * buf, size_t len, StaticSlice )
Construct a slice from a static buffer
Defined at line 64 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (const Slice & other)
Copy constructor, adds a reference.
Defined at line 69 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (Slice && other)
Move constructor, steals a reference.
Defined at line 72 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
Slice & operator= (Slice other)
Assignment, reference count is unchanged.
Defined at line 77 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (void * buf, size_t len, void (*)(void *) destroy, void * user_data)
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)
Defined at line 87 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (void * buf, size_t len, void (*)(void *) destroy)
Specialization of above for common case where buf == user_data
Defined at line 91 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
void Slice (void * buf, size_t len, void (*)(void *, size_t) destroy)
Similar to the above but has a destroy that also takes slice length
Defined at line 95 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
size_t size ()
Byte size.
Defined at line 99 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
const uint8_t * begin ()
Raw pointer to the beginning (first element) of the slice.
Defined at line 102 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
const uint8_t * end ()
Raw pointer to the end (one byte
the last element) of the slice.
Defined at line 105 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
Slice sub (size_t begin, size_t end)
Returns a substring of the `slice` as another slice.
Defined at line 108 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
grpc_slice c_slice ()
Raw C slice. Caller needs to call grpc_slice_unref when done.
Defined at line 113 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
Enumerations
enum AddRef
| Name | Value |
|---|---|
| ADD_REF | 0 |
Defined at line 40 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
enum StealRef
| Name | Value |
|---|---|
| STEAL_REF | 0 |
Defined at line 44 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
enum StaticSlice
| Name | Value |
|---|---|
| STATIC_SLICE | 0 |
Defined at line 61 of file ../../third_party/grpc-migrating/src/include/grpcpp/support/slice.h
Friends
class ByteBuffer