|
GRPC C++
1.11.0
|
A wrapper around grpc_slice. More...
#include <slice.h>
Public Types | |
| enum | AddRef { ADD_REF } |
| enum | StealRef { STEAL_REF } |
| enum | StaticSlice { STATIC_SLICE } |
Public Member Functions | |
| Slice () | |
| Construct an empty slice. More... | |
| ~Slice () | |
| Destructor - drops one reference. 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 (const void *buf, size_t len) | |
| Construct a slice from a copied buffer. More... | |
| Slice (const grpc::string &str) | |
| Construct a slice from a copied string. More... | |
| Slice (const void *buf, size_t len, StaticSlice) | |
| Construct a slice from a static buffer. More... | |
| Slice (const Slice &other) | |
| Copy constructor, adds a reference. More... | |
| Slice & | operator= (Slice other) |
| Assignment, reference count is unchanged. More... | |
| Slice (void *buf, size_t len, void(*destroy)(void *), void *user_data) | |
| Create a slice pointing at some data. 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 *, size_t)) | |
| Similar to the above but has a destroy that also takes slice length. More... | |
| size_t | size () const |
| Byte size. More... | |
| const uint8_t * | begin () const |
| Raw pointer to the beginning (first element) of the slice. More... | |
| const uint8_t * | end () const |
| Raw pointer to the end (one byte past the last element) of the slice. More... | |
| grpc_slice | c_slice () const |
| Raw C slice. Caller needs to call grpc_slice_unref when done. More... | |
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.
| enum grpc::Slice::AddRef |
| grpc::Slice::Slice | ( | ) |
Construct an empty slice.
| grpc::Slice::~Slice | ( | ) |
Destructor - drops one reference.
| grpc::Slice::Slice | ( | grpc_slice | slice, |
| AddRef | |||
| ) |
Construct a slice from slice, adding a reference.
| grpc::Slice::Slice | ( | grpc_slice | slice, |
| StealRef | |||
| ) |
Construct a slice from slice, stealing a reference.
| grpc::Slice::Slice | ( | size_t | len | ) |
Allocate a slice of specified size.
| grpc::Slice::Slice | ( | const void * | buf, |
| size_t | len | ||
| ) |
Construct a slice from a copied buffer.
| grpc::Slice::Slice | ( | const grpc::string & | str | ) |
Construct a slice from a copied string.
| grpc::Slice::Slice | ( | const void * | buf, |
| size_t | len, | ||
| StaticSlice | |||
| ) |
Construct a slice from a static buffer.
| grpc::Slice::Slice | ( | const Slice & | other | ) |
Copy constructor, adds a reference.
| grpc::Slice::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)
|
inline |
Specialization of above for common case where buf == user_data.
| grpc::Slice::Slice | ( | void * | buf, |
| size_t | len, | ||
| void(*)(void *, size_t) | destroy | ||
| ) |
Similar to the above but has a destroy that also takes slice length.
|
inline |
Raw pointer to the beginning (first element) of the slice.
| grpc_slice grpc::Slice::c_slice | ( | ) | const |
Raw C slice. Caller needs to call grpc_slice_unref when done.
|
inline |
Raw pointer to the end (one byte past the last element) of the slice.
|
inline |
Byte size.
|
friend |
1.8.13