Apollo  6.0
Open source self driving car software
module_controller.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
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 #ifndef CYBER_MAINBOARD_MODULE_CONTROLLER_H_
17 #define CYBER_MAINBOARD_MODULE_CONTROLLER_H_
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "cyber/proto/dag_conf.pb.h"
24 
28 
29 namespace apollo {
30 namespace cyber {
31 namespace mainboard {
32 
33 using apollo::cyber::proto::DagConfig;
34 
36  public:
37  explicit ModuleController(const ModuleArgument& args);
38  virtual ~ModuleController() = default;
39 
40  bool Init();
41  bool LoadAll();
42  void Clear();
43 
44  private:
45  bool LoadModule(const std::string& path);
46  bool LoadModule(const DagConfig& dag_config);
47  int GetComponentNum(const std::string& path);
48  int total_component_nums = 0;
49  bool has_timer_component = false;
50 
51  ModuleArgument args_;
52  class_loader::ClassLoaderManager class_loader_manager_;
53  std::vector<std::shared_ptr<ComponentBase>> component_list_;
54 };
55 
57  : args_(args) {}
58 
59 inline bool ModuleController::Init() { return LoadAll(); }
60 
61 } // namespace mainboard
62 } // namespace cyber
63 } // namespace apollo
64 
65 #endif // CYBER_MAINBOARD_MODULE_CONTROLLER_H_
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
ModuleController(const ModuleArgument &args)
Definition: module_controller.h:56
Definition: class_loader_manager.h:32
Definition: module_argument.h:34
Definition: module_controller.h:35
bool Init()
Definition: module_controller.h:59