21 #include "glog/logging.h" 26 mapping::proto::SerializationHeader ReadHeaderOrDie(
27 ProtoStreamReaderInterface*
const reader) {
28 mapping::proto::SerializationHeader header;
29 CHECK(reader->ReadProto(&header)) <<
"Failed to read SerializationHeader.";
33 bool IsVersionSupported(
const mapping::proto::SerializationHeader& header) {
40 const std::string& file_name) {
48 :
reader_(reader), header_(ReadHeaderOrDie(reader)) {
49 CHECK(IsVersionSupported(
header_)) <<
"Unsupported serialization format \"" 50 <<
header_.format_version() <<
"\"";
53 <<
"Serialized stream misses PoseGraph.";
55 <<
"Serialized stream order corrupt. Expecting `PoseGraph` after " 56 "`SerializationHeader`, but got field tag " 60 <<
"Serialized stream misses `AllTrajectoryBuilderOptions`.";
62 <<
"Serialized stream order corrupt. Expecting " 63 "`AllTrajectoryBuilderOptions` after " 64 "PoseGraph, got field tag " 67 CHECK_EQ(
pose_graph_.pose_graph().trajectory_size(),
69 .options_with_sensor_ids_size());
73 mapping::proto::SerializedData* data) {
mapping::proto::SerializedData pose_graph_
std::unique_ptr< InMemoryProtoStreamReader > reader_
static constexpr int kMappingStateSerializationFormatVersion
ProtoStreamReaderInterface * reader_
bool ReadNextSerializedData(mapping::proto::SerializedData *data)
ProtoStreamDeserializer(ProtoStreamReaderInterface *const reader)
virtual bool ReadProto(google::protobuf::Message *proto)=0
mapping::proto::PoseGraph & pose_graph()
mapping::proto::PoseGraph DeserializePoseGraphFromFile(const std::string &file_name)
mapping::proto::SerializationHeader header_
mapping::proto::SerializedData all_trajectory_builder_options_