Go to the documentation of this file.
19 #ifndef GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H
20 #define GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H
24 #include <type_traits>
46 template <
class ProtoBufferWriter,
class T>
51 "ProtoBufferWriter must be a subclass of "
52 "::protobuf::io::ZeroCopyOutputStream");
54 int byte_size =
static_cast<int>(
msg.ByteSizeLong());
66 return msg.SerializeToZeroCopyStream(&
writer)
72 template <
class ProtoBufferReader,
class T>
77 "ProtoBufferReader must be a subclass of "
78 "::protobuf::io::ZeroCopyInputStream");
85 if (!
reader.status().ok()) {
88 if (!
msg->ParseFromZeroCopyStream(&
reader)) {
98 #ifdef GRPC_OPEN_SOURCE_PROTO
103 class SerializationTraits<
104 T, typename
std::enable_if<
105 std::is_base_of<grpc::protobuf::MessageLite, T>::value>
::type> {
108 ByteBuffer* bb,
bool* own_buffer) {
109 return GenericSerialize<ProtoBufferWriter, T>(
msg, bb, own_buffer);
114 return GenericDeserialize<ProtoBufferReader, T>(
buffer,
msg);
121 #endif // GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H
GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream
void Swap(ByteBuffer *other)
Swap the state of *this and *other.
GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream
#define T(upbtypeconst, upbtype, ctype, default_value)
Status GenericSerialize(const grpc::protobuf::MessageLite &msg, ByteBuffer *bb, bool *own_buffer)
virtual const Status & ok()=0
CoreCodegenInterface * g_core_codegen_interface
GRPC_CUSTOM_MESSAGELITE MessageLite
Status GenericDeserialize(ByteBuffer *buffer, grpc::protobuf::MessageLite *msg)
const int kProtoBufferWriterMaxBufferLength
GRPC_CUSTOM_UTIL_STATUS Status
#define GRPC_SLICE_INLINED_SIZE
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:47