Go to the documentation of this file.
19 #ifndef GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H
20 #define GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H
34 class ServerInterface;
36 class ServerInterface;
39 template <
class RequestType,
class ResponseType>
41 template <
class RequestType,
class ResponseType>
43 template <
class RequestType>
46 template <
class ServiceType,
class RequestType,
class ResponseType>
48 template <::grpc::StatusCode code>
54 class ExternalConnectionAcceptorImpl;
57 class GrpcByteBufferPeer;
71 static_assert(std::is_same<decltype(slices[0].slice_),
grpc_slice>::value,
72 "Slice must have same representation as grpc_slice");
74 "Slice must have same representation as grpc_slice");
79 "ByteBuffer must have same representation as "
82 "ByteBuffer must have same representation as "
119 Status Dump(std::vector<Slice>* slices)
const;
144 return buffer_ ==
nullptr
152 other->buffer_ = buffer_;
157 bool Valid()
const {
return (buffer_ !=
nullptr); }
166 template <
class RequestType>
169 template <
class ServiceType,
class RequestType,
class ResponseType>
171 template <
class RequestType,
class ResponseType>
173 template <
class RequestType,
class ResponseType>
175 template <StatusCode code>
197 class ByteBufferPointer {
212 ByteBufferPointer bbuf_ptr()
const {
return ByteBufferPointer(
this); }
219 dest->set_buffer(byte_buffer->buffer_);
232 #endif // GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H
This is a specialization of the protobuf class ZeroCopyOutputStream.
Definition: proto_buffer_writer.h:53
Definition: call_op_set.h:526
void Duplicate()
Make a duplicate copy of the internals of this byte buffer so that we have our own owned version of i...
Definition: byte_buffer.h:134
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
Definition: call_op_set.h:282
size_t Length() const
Buffer size in bytes.
Definition: byte_buffer.h:143
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:49
void * UnaryDeserializeHelper(grpc_call *, grpc_byte_buffer *, ::grpc::Status *, RequestType *)
A helper function with reduced templating to do deserializing.
Definition: method_handler.h:80
virtual const Status & ok()=0
ByteBuffer(const Slice *slices, size_t nslices)
Construct buffer from slices, of which there are nslices.
Definition: byte_buffer.h:67
ByteBuffer & operator=(const ByteBuffer &buf)
Wrapper of core function grpc_byte_buffer_copy .
Definition: byte_buffer.h:107
~ByteBuffer()
Definition: byte_buffer.h:98
virtual grpc_byte_buffer * grpc_byte_buffer_copy(grpc_byte_buffer *bb)=0
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)=0
ByteBuffer()
Constuct an empty buffer.
Definition: byte_buffer.h:64
Did it work? If it didn't, why?
Definition: status.h:31
void Clear()
Remove all data.
Definition: byte_buffer.h:122
static Status Deserialize(ByteBuffer *byte_buffer, ByteBuffer *dest)
Definition: byte_buffer.h:218
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
Definition: byte_buffer.h:56
Definition: grpc_types.h:40
A sequence of bytes.
Definition: byte_buffer.h:61
Definition: byte_buffer.h:40
static Status Serialize(const ByteBuffer &source, ByteBuffer *buffer, bool *own_buffer)
Definition: byte_buffer.h:222
void Swap(ByteBuffer *other)
Swap the state of *this and *other.
Definition: byte_buffer.h:150
This is a specialization of the protobuf class ZeroCopyInputStream The principle is to get one chunk ...
Definition: proto_buffer_reader.h:46
Definition: byte_buffer.h:42
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice.h:60
virtual grpc_byte_buffer * grpc_raw_byte_buffer_create(grpc_slice *slice, size_t nslices)=0
Defines how to serialize and deserialize some type.
Definition: serialization_traits.h:58
friend class internal::GrpcByteBufferPeer
Definition: byte_buffer.h:181
A wrapper around grpc_slice.
Definition: slice.h:35
A wrapper class of an application provided server streaming handler.
Definition: byte_buffer.h:47
static const Status & OK
An OK pre-defined instance.
Definition: status.h:105
Status Dump(std::vector< Slice > *slices) const
Dump (read) the buffer contents into slices.
ByteBuffer(const ByteBuffer &buf)
Constuct a byte buffer by referencing elements of existing buffer buf.
Definition: byte_buffer.h:96
friend class internal::ExternalConnectionAcceptorImpl
Definition: byte_buffer.h:182
bool Valid() const
Is this ByteBuffer valid?
Definition: byte_buffer.h:157
virtual size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) GRPC_MUST_USE_RESULT=0
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue.h:96
Definition: byte_buffer.h:52
void Release()
Forget underlying byte buffer without destroying Use this only for un-owned byte buffers.
Definition: byte_buffer.h:140
Definition: server_interface.h:65