points_processor_pipeline_builder.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 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_POINTS_PROCESSOR_PIPELINE_BUILDER_H_
18 #define CARTOGRAPHER_IO_POINTS_PROCESSOR_PIPELINE_BUILDER_H_
19 
20 #include <string>
21 #include <unordered_map>
22 #include <vector>
23 
27 #include "cartographer/mapping/proto/trajectory.pb.h"
28 
29 namespace cartographer {
30 namespace io {
31 
32 // Builder to create a points processor pipeline out of a Lua configuration.
33 // You can register all built-in PointsProcessors using
34 // 'RegisterBuiltInPointsProcessors'. Non-built-in PointsProcessors must define
35 // a name and a factory method for building itself from a
36 // LuaParameterDictionary. See the various built-in PointsProcessors for
37 // examples.
39  public:
40  using FactoryFunction = std::function<std::unique_ptr<PointsProcessor>(
42 
44 
46  delete;
48  const PointsProcessorPipelineBuilder&) = delete;
49 
50  // Register a new PointsProcessor type uniquly identified by 'name' which will
51  // be created using 'factory'.
52  void Register(const std::string& name, FactoryFunction factory);
53 
54  std::vector<std::unique_ptr<PointsProcessor>> CreatePipeline(
55  common::LuaParameterDictionary* dictionary) const;
56 
57  private:
58  std::unordered_map<std::string, FactoryFunction> factories_;
59 };
60 
61 // Register all 'PointsProcessor' that ship with Cartographer with this
62 // 'builder'.
64  const std::vector<mapping::proto::Trajectory>& trajectories,
65  const FileWriterFactory& file_writer_factory,
67 
68 } // namespace io
69 } // namespace cartographer
70 
71 #endif // CARTOGRAPHER_IO_POINTS_PROCESSOR_PIPELINE_BUILDER_H_
std::function< std::unique_ptr< PointsProcessor >(common::LuaParameterDictionary *, PointsProcessor *next)> FactoryFunction
std::function< std::unique_ptr< FileWriter >(const std::string &filename)> FileWriterFactory
Definition: file_writer.h:66
std::unordered_map< std::string, FactoryFunction > factories_
PointsProcessorPipelineBuilder & operator=(const PointsProcessorPipelineBuilder &)=delete
std::vector< std::unique_ptr< PointsProcessor > > CreatePipeline(common::LuaParameterDictionary *dictionary) const
void Register(const std::string &name, FactoryFunction factory)
void RegisterBuiltInPointsProcessors(const std::vector< mapping::proto::Trajectory > &trajectories, const FileWriterFactory &file_writer_factory, PointsProcessorPipelineBuilder *builder)


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