17 #ifndef CARTOGRAPHER_IO_INTERNAL_IN_MEMORY_PROTO_STREAM_H_ 18 #define CARTOGRAPHER_IO_INTERNAL_IN_MEMORY_PROTO_STREAM_H_ 25 #include "google/protobuf/message.h" 37 std::function<bool(const google::protobuf::Message* proto)>;
43 void WriteProto(
const google::protobuf::Message& proto)
override;
44 bool Close()
override;
54 std::queue<std::unique_ptr<google::protobuf::Message>>&& state_chunks)
55 : state_chunks_(std::move(state_chunks)) {}
63 template <
typename MessageType>
65 state_chunks_.push(common::make_unique<MessageType>(proto));
68 bool ReadProto(google::protobuf::Message* proto)
override;
69 bool eof()
const override {
return state_chunks_.empty(); }
78 #endif // CARTOGRAPHER_IO_INTERNAL_IN_MEMORY_PROTO_STREAM_H_ WriterCallback writer_callback_
std::queue< std::unique_ptr< google::protobuf::Message > > state_chunks_
std::function< bool(const google::protobuf::Message *proto)> WriterCallback
bool eof() const override
void WriteProto(const google::protobuf::Message &proto) override
InMemoryProtoStreamReader(std::queue< std::unique_ptr< google::protobuf::Message >> &&state_chunks)
void AddProto(const MessageType &proto)
ForwardingProtoStreamWriter(WriterCallback writer_callback)
~ForwardingProtoStreamWriter()=default