proto_stream_interface.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef CARTOGRAPHER_IO_PROTO_STREAM_INTERFACE_H_
00018 #define CARTOGRAPHER_IO_PROTO_STREAM_INTERFACE_H_
00019 
00020 #include "cartographer/common/port.h"
00021 #include "google/protobuf/message.h"
00022 
00023 namespace cartographer {
00024 namespace io {
00025 
00026 // A writer for writing proto messages to a pbstream.
00027 class ProtoStreamWriterInterface {
00028  public:
00029   virtual ~ProtoStreamWriterInterface() {}
00030 
00031   // Serializes, compressed and writes the 'proto' to the file.
00032   virtual void WriteProto(const google::protobuf::Message& proto) = 0;
00033 
00034   // This should be called to check whether writing was successful.
00035   virtual bool Close() = 0;
00036 };
00037 
00038 // A reader of the format produced by ProtoStreamWriter.
00039 class ProtoStreamReaderInterface {
00040  public:
00041   ProtoStreamReaderInterface() = default;
00042   virtual ~ProtoStreamReaderInterface() {}
00043 
00044   // Deserialize compressed proto from the pb stream.
00045   virtual bool ReadProto(google::protobuf::Message* proto) = 0;
00046 
00047   // 'End-of-file' marker for the pb stream.
00048   virtual bool eof() const = 0;
00049 };
00050 
00051 }  // namespace io
00052 }  // namespace cartographer
00053 
00054 #endif  // CARTOGRAPHER_IO_PROTO_STREAM_INTERFACE_H_


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35