proto_stream_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CARTOGRAPHER_IO_PROTO_STREAM_INTERFACE_H_
18 #define CARTOGRAPHER_IO_PROTO_STREAM_INTERFACE_H_
19 
21 #include "google/protobuf/message.h"
22 
23 namespace cartographer {
24 namespace io {
25 
26 // A writer for writing proto messages to a pbstream.
28  public:
30 
31  // Serializes, compressed and writes the 'proto' to the file.
32  virtual void WriteProto(const google::protobuf::Message& proto) = 0;
33 
34  // This should be called to check whether writing was successful.
35  virtual bool Close() = 0;
36 };
37 
38 // A reader of the format produced by ProtoStreamWriter.
40  public:
41  ProtoStreamReaderInterface() = default;
43 
44  // Deserialize compressed proto from the pb stream.
45  virtual bool ReadProto(google::protobuf::Message* proto) = 0;
46 
47  // 'End-of-file' marker for the pb stream.
48  virtual bool eof() const = 0;
49 };
50 
51 } // namespace io
52 } // namespace cartographer
53 
54 #endif // CARTOGRAPHER_IO_PROTO_STREAM_INTERFACE_H_
virtual void WriteProto(const google::protobuf::Message &proto)=0


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58