scenario_simulator_v2 C++ API
traffic_controller.hpp
Go to the documentation of this file.
1 
12 // Copyright 2015 TIER IV.inc. All rights reserved.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 
26 #ifndef TRAFFIC_SIMULATOR__TRAFFIC__TRAFFIC_CONTROLLER_HPP_
27 #define TRAFFIC_SIMULATOR__TRAFFIC__TRAFFIC_CONTROLLER_HPP_
28 
29 #include <memory>
30 #include <set>
31 #include <string>
35 #include <utility>
36 #include <vector>
37 
38 namespace traffic_simulator
39 {
40 namespace traffic
41 {
43 {
44 public:
45  explicit TrafficController(
46  const std::shared_ptr<entity::EntityManager> entity_manager_ptr,
47  const std::set<std::uint8_t> auto_sink_entity_types /*= {}*/);
48 
49  template <typename T, typename... Ts>
50  void addModule(Ts &&... xs)
51  {
52  auto module_ptr = std::make_shared<T>(std::forward<Ts>(xs)...);
53  modules_.emplace_back(module_ptr);
54  }
55  auto execute(const double current_time, const double step_time) -> void;
56  auto makeDebugMarker() const -> visualization_msgs::msg::MarkerArray;
57 
58 private:
59  auto appendAutoSinks(const std::set<std::uint8_t> & auto_sink_entity_types) -> void;
60  const std::shared_ptr<entity::EntityManager> entity_manager_ptr_;
61  std::vector<std::shared_ptr<TrafficModuleBase>> modules_;
62 };
63 } // namespace traffic
64 } // namespace traffic_simulator
65 
66 #endif // TRAFFIC_SIMULATOR__TRAFFIC__TRAFFIC_CONTROLLER_HPP_
Definition: traffic_controller.hpp:43
TrafficController(const std::shared_ptr< entity::EntityManager > entity_manager_ptr, const std::set< std::uint8_t > auto_sink_entity_types)
Definition: traffic_controller.cpp:39
void addModule(Ts &&... xs)
Definition: traffic_controller.hpp:50
auto makeDebugMarker() const -> visualization_msgs::msg::MarkerArray
Definition: traffic_controller.cpp:74
auto execute(const double current_time, const double step_time) -> void
Definition: traffic_controller.cpp:67
Definition: traffic_module_base.hpp:36
Definition: cache.hpp:27
Definition: api.hpp:48
Definition: junit5.hpp:25