Go to the documentation of this file.
19 #ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
20 #define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
24 #include <type_traits>
53 : byte_count_(0), backup_count_(0), status_() {
56 if (!buffer->
Valid() ||
58 &reader_, buffer->c_buffer())) {
60 "Couldn't initialize byte buffer reader");
72 bool Next(
const void** data,
int* size)
override {
77 if (backup_count_ > 0) {
81 *size =
static_cast<int>(backup_count_);
105 backup_count_ = count;
110 bool Skip(
int count)
override {
113 while (
Next(&data, &size)) {
126 int64_t
ByteCount()
const override {
return byte_count_ - backup_count_; }
142 int64_t backup_count_;
151 #endif // GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
#define GRPC_SLICE_LENGTH(slice)
Definition: slice.h:104
virtual int grpc_byte_buffer_reader_peek(grpc_byte_buffer_reader *reader, grpc_slice **slice)=0
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
~ProtoBufferReader() override
Definition: proto_buffer_reader.h:64
ProtoBufferReader(ByteBuffer *buffer)
Constructs buffer reader from buffer.
Definition: proto_buffer_reader.h:52
::google::protobuf::io::ZeroCopyInputStream ZeroCopyInputStream
Definition: config_protobuf.h:101
int64_t backup_count()
Definition: proto_buffer_reader.h:134
bool ok() const
Is the status OK?
Definition: status.h:126
void BackUp(int count) override
The proto library calls this to indicate that we should back up count bytes that have already been re...
Definition: proto_buffer_reader.h:103
Did it work? If it didn't, why?
Definition: status.h:35
grpc_byte_buffer_reader * reader()
Definition: proto_buffer_reader.h:136
int64_t ByteCount() const override
Returns the total number of bytes read since this object was created.
Definition: proto_buffer_reader.h:126
bool Skip(int count) override
The proto library calls this to skip over count bytes.
Definition: proto_buffer_reader.h:110
A sequence of bytes.
Definition: byte_buffer.h:61
This is a specialization of the protobuf class ZeroCopyInputStream The principle is to get one chunk ...
Definition: proto_buffer_reader.h:48
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1].
Definition: slice.h:65
void set_byte_count(int64_t byte_count)
Definition: proto_buffer_reader.h:133
grpc_slice ** mutable_slice_ptr()
Definition: proto_buffer_reader.h:138
::google::protobuf::util::Status Status
Definition: config_protobuf.h:93
virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, grpc_byte_buffer *buffer) GRPC_MUST_USE_RESULT=0
Status status() const
Returns the status of the buffer reader.
Definition: proto_buffer_reader.h:98
#define GRPC_SLICE_START_PTR(slice)
Definition: slice.h:101
bool Valid() const
Is this ByteBuffer valid?
Definition: byte_buffer.h:164
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue.h:98
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:151
grpc_slice * slice()
Definition: proto_buffer_reader.h:137
Definition: byte_buffer_reader.h:30
bool Next(const void **data, int *size) override
Give the proto library a chunk of data from the stream.
Definition: proto_buffer_reader.h:72
void set_backup_count(int64_t backup_count)
Definition: proto_buffer_reader.h:135
virtual void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader)=0
@ INTERNAL
Internal errors.
Definition: status_code_enum.h:121