19 #ifndef GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H 20 #define GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H 34 class ServerInterface;
36 class ServerInterface;
39 class CallOpSendMessage;
44 template <
class ServiceType,
class RequestType,
class ResponseType>
46 template <
class ServiceType,
class RequestType,
class ResponseType>
48 template <
class RequestType,
class ResponseType>
50 template <
class RequestType,
class ResponseType>
52 template <StatusCode code>
54 class ExternalConnectionAcceptorImpl;
57 class GrpcByteBufferPeer;
58 template <
class ServiceType,
class RequestType,
class ResponseType>
60 template <
class ServiceType,
class RequestType,
class ResponseType>
75 static_assert(std::is_same<decltype(slices[0].slice_),
grpc_slice>::value,
76 "Slice must have same representation as grpc_slice");
78 "Slice must have same representation as grpc_slice");
83 "ByteBuffer must have same representation as " 86 "ByteBuffer must have same representation as " 93 reinterpret_cast<grpc_slice*>(const_cast<Slice*>(slices)), nslices);
123 Status Dump(std::vector<Slice>* slices)
const;
148 return buffer_ ==
nullptr 156 other->buffer_ = buffer_;
161 bool Valid()
const {
return (buffer_ !=
nullptr); }
170 template <
class ServiceType,
class RequestType,
class ResponseType>
171 friend class RpcMethodHandler;
172 template <
class ServiceType,
class RequestType,
class ResponseType>
173 friend class ServerStreamingHandler;
174 template <
class ServiceType,
class RequestType,
class ResponseType>
176 template <
class ServiceType,
class RequestType,
class ResponseType>
178 template <
class RequestType,
class ResponseType>
180 template <
class RequestType,
class ResponseType>
181 friend class ::grpc::internal::CallbackServerStreamingHandler;
182 template <StatusCode code>
188 friend class internal::GrpcByteBufferPeer;
189 friend class internal::ExternalConnectionAcceptorImpl;
204 class ByteBufferPointer {
215 ByteBufferPointer bbuf_ptr()
const {
return ByteBufferPointer(
this); }
222 dest->set_buffer(byte_buffer->buffer_);
235 #endif // GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H
void Clear()
Remove all data.
Definition: byte_buffer.h:126
A wrapper class of an application provided server streaming handler.
Definition: byte_buffer.h:47
static Status Serialize(const ByteBuffer &source, ByteBuffer *buffer, bool *own_buffer)
Definition: byte_buffer.h:225
This is a specialization of the protobuf class ZeroCopyOutputStream.
Definition: proto_buffer_writer.h:53
size_t Length() const
Buffer size in bytes.
Definition: byte_buffer.h:147
A wrapper around grpc_slice.
Definition: slice.h:35
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:60
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:138
Definition: grpc_types.h:40
ByteBuffer & operator=(const ByteBuffer &buf)
Wrapper of core function grpc_byte_buffer_copy .
Definition: byte_buffer.h:111
ByteBuffer(const Slice *slices, size_t nslices)
Construct buffer from slices, of which there are nslices.
Definition: byte_buffer.h:71
bool Valid() const
Is this ByteBuffer valid?
Definition: byte_buffer.h:161
void Swap(ByteBuffer *other)
Swap the state of *this and *other.
Definition: byte_buffer.h:154
Definition: byte_buffer.h:56
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)=0
Defines how to serialize and deserialize some type.
Definition: serialization_traits.h:58
void Release()
Forget underlying byte buffer without destroying Use this only for un-owned byte buffers.
Definition: byte_buffer.h:144
static Status Deserialize(ByteBuffer *byte_buffer, ByteBuffer *dest)
Definition: byte_buffer.h:221
Definition: call_op_set.h:288
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
A wrapper class of an application provided rpc method handler.
Definition: byte_buffer.h:45
CoreCodegenInterface * g_core_codegen_interface
Definition: call_op_set.h:51
virtual grpc_byte_buffer * grpc_raw_byte_buffer_create(grpc_slice *slice, size_t nslices)=0
ByteBuffer(const ByteBuffer &buf)
Constuct a byte buffer by referencing elements of existing buffer buf.
Definition: byte_buffer.h:100
Definition: byte_buffer.h:41
Definition: server_interface.h:58
virtual grpc_byte_buffer * grpc_byte_buffer_copy(grpc_byte_buffer *bb)=0
Definition: byte_buffer.h:49
Base class for running an RPC handler.
Definition: rpc_service_method.h:41
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:53
Did it work? If it didn't, why?
Definition: status.h:31
~ByteBuffer()
Definition: byte_buffer.h:102
virtual const Status & ok()=0
Definition: call_op_set.h:516
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:51
static const Status & OK
An OK pre-defined instance.
Definition: status.h:105
ByteBuffer()
Constuct an empty buffer.
Definition: byte_buffer.h:68
A sequence of bytes.
Definition: byte_buffer.h:65
virtual size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) GRPC_MUST_USE_RESULT=0