proto_stream_deserializer.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_DESERIALIZER_H_
18 #define CARTOGRAPHER_IO_PROTO_STREAM_DESERIALIZER_H_
19 
21 #include "cartographer/mapping/proto/pose_graph.pb.h"
22 #include "cartographer/mapping/proto/serialization.pb.h"
23 #include "cartographer/mapping/proto/trajectory_builder_options.pb.h"
24 
25 namespace cartographer {
26 namespace io {
27 
28 // Helper function for deserializing the PoseGraph from a proto stream file.
29 mapping::proto::PoseGraph DeserializePoseGraphFromFile(
30  const std::string& file_name);
31 
32 // Helper for deserializing a previously serialized mapping state from a
33 // proto stream, abstracting away the format parsing logic.
35  public:
37 
41 
42  mapping::proto::SerializationHeader& header() { return header_; }
43 
44  mapping::proto::PoseGraph& pose_graph() {
45  return *pose_graph_.mutable_pose_graph();
46  }
47  const mapping::proto::PoseGraph& pose_graph() const {
48  return pose_graph_.pose_graph();
49  }
50 
51  const mapping::proto::AllTrajectoryBuilderOptions&
53  return all_trajectory_builder_options_.all_trajectory_builder_options();
54  }
55 
56  // Reads the next `SerializedData` message of the ProtoStream into `data`.
57  // Returns `true` if the message was successfully read or `false` in case
58  // there are no-more messages or an error occurred.
59  bool ReadNextSerializedData(mapping::proto::SerializedData* data);
60 
61  private:
63 
64  mapping::proto::SerializationHeader header_;
65  mapping::proto::SerializedData pose_graph_;
66  mapping::proto::SerializedData all_trajectory_builder_options_;
67 };
68 
69 } // namespace io
70 } // namespace cartographer
71 
72 #endif // CARTOGRAPHER_IO_PROTO_STREAM_DESERIALIZER_H_
ProtoStreamDeserializer & operator=(const ProtoStreamDeserializer &)=delete
const mapping::proto::PoseGraph & pose_graph() const
mapping::proto::SerializationHeader & header()
bool ReadNextSerializedData(mapping::proto::SerializedData *data)
ProtoStreamDeserializer(ProtoStreamReaderInterface *const reader)
mapping::proto::PoseGraph DeserializePoseGraphFromFile(const std::string &file_name)
const mapping::proto::AllTrajectoryBuilderOptions & all_trajectory_builder_options()
mapping::proto::SerializationHeader header_
mapping::proto::SerializedData all_trajectory_builder_options_


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