dispatchable.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_SENSOR_INTERNAL_DISPATCHABLE_H_
18 #define CARTOGRAPHER_SENSOR_INTERNAL_DISPATCHABLE_H_
19 
22 
23 namespace cartographer {
24 namespace sensor {
25 
26 template <typename DataType>
27 class Dispatchable : public Data {
28  public:
29  Dispatchable(const std::string &sensor_id, const DataType &data)
30  : Data(sensor_id), data_(data) {}
31 
32  common::Time GetTime() const override { return data_.time; }
34  mapping::TrajectoryBuilderInterface *const trajectory_builder) override {
35  trajectory_builder->AddSensorData(sensor_id_, data_);
36  }
37  const DataType &data() const { return data_; }
38 
39  private:
40  const DataType data_;
41 };
42 
43 template <typename DataType>
44 std::unique_ptr<Dispatchable<DataType>> MakeDispatchable(
45  const std::string &sensor_id, const DataType &data) {
46  return common::make_unique<Dispatchable<DataType>>(sensor_id, data);
47 }
48 
49 } // namespace sensor
50 } // namespace cartographer
51 
52 #endif // CARTOGRAPHER_SENSOR_INTERNAL_DISPATCHABLE_H_
void AddToTrajectoryBuilder(mapping::TrajectoryBuilderInterface *const trajectory_builder) override
Definition: dispatchable.h:33
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
const std::string sensor_id_
Definition: data.h:43
const DataType & data() const
Definition: dispatchable.h:37
Dispatchable(const std::string &sensor_id, const DataType &data)
Definition: dispatchable.h:29
common::Time GetTime() const override
Definition: dispatchable.h:32
virtual void AddSensorData(const std::string &sensor_id, const sensor::TimedPointCloudData &timed_point_cloud_data)=0
std::unique_ptr< Dispatchable< DataType > > MakeDispatchable(const std::string &sensor_id, const DataType &data)
Definition: dispatchable.h:44


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