collator.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_COLLATOR_H_
18 #define CARTOGRAPHER_SENSOR_INTERNAL_COLLATOR_H_
19 
20 #include <functional>
21 #include <memory>
22 #include <unordered_map>
23 #include <unordered_set>
24 #include <vector>
25 
29 
30 namespace cartographer {
31 namespace sensor {
32 
33 class Collator : public CollatorInterface {
34  public:
35  Collator() {}
36 
37  Collator(const Collator&) = delete;
38  Collator& operator=(const Collator&) = delete;
39 
40  void AddTrajectory(int trajectory_id,
41  const std::unordered_set<std::string>& expected_sensor_ids,
42  const Callback& callback) override;
43 
44  void FinishTrajectory(int trajectory_id) override;
45 
46  void AddSensorData(int trajectory_id, std::unique_ptr<Data> data) override;
47 
48  void Flush() override;
49 
51 
52  private:
53  // Queue keys are a pair of trajectory ID and sensor identifier.
55 
56  // Map of trajectory ID to all associated QueueKeys.
57  std::unordered_map<int, std::vector<QueueKey>> queue_keys_;
58 };
59 
60 } // namespace sensor
61 } // namespace cartographer
62 
63 #endif // CARTOGRAPHER_SENSOR_INTERNAL_COLLATOR_H_
std::function< void(const std::string &, std::unique_ptr< Data >)> Callback
void FinishTrajectory(int trajectory_id) override
Definition: collator.cc:36
common::optional< int > GetBlockingTrajectoryId() const override
Definition: collator.cc:50
void AddSensorData(int trajectory_id, std::unique_ptr< Data > data) override
Definition: collator.cc:42
void AddTrajectory(int trajectory_id, const std::unordered_set< std::string > &expected_sensor_ids, const Callback &callback) override
Definition: collator.cc:22
OrderedMultiQueue queue_
Definition: collator.h:54
std::unordered_map< int, std::vector< QueueKey > > queue_keys_
Definition: collator.h:57
Collator & operator=(const Collator &)=delete


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