Apollo 10.0
自动驾驶开放平台
module_argument.h
浏览该文件的文档.
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
17#ifndef CYBER_MAINBOARD_MODULE_ARGUMENT_H_
18#define CYBER_MAINBOARD_MODULE_ARGUMENT_H_
19
20#include <list>
21#include <string>
22
24#include "cyber/common/log.h"
25#include "cyber/common/types.h"
26
27namespace apollo {
28namespace cyber {
29namespace mainboard {
30
31static const char DEFAULT_process_group_[] = "mainboard_default";
32static const char DEFAULT_sched_name_[] = "CYBER_DEFAULT";
33
34// code for command line arguments without short parameters
35static const int ARGS_OPT_CODE_PLUGIN = 1001;
36static const int ARGS_OPT_CODE_DISABLE_PLUGIN_AUTOLOAD = 1002;
37
39 public:
40 ModuleArgument() = default;
41 virtual ~ModuleArgument() = default;
42 void DisplayUsage();
43 void ParseArgument(int argc, char* const argv[]);
44 void GetOptions(const int argc, char* const argv[]);
45 const std::string& GetBinaryName() const;
46 const std::string& GetProcessGroup() const;
47 const std::string& GetSchedName() const;
48 const std::list<std::string>& GetDAGConfList() const;
49 const std::list<std::string>& GetPluginDescriptionList() const;
50 const bool GetEnableCpuprofile() const { return enable_cpuprofile_; }
51 const std::string GetProfileFilename() const { return profile_filename_; }
52 const bool GetEnableHeapprofile() const { return enable_heapprofile_; }
53 const std::string GetHeapProfileFilename() const {
54 return heapprofile_filename_;
55 }
56 const bool& GetDisablePluginsAutoLoad() const;
57
58 private:
59 std::list<std::string> dag_conf_list_;
60 std::list<std::string> plugin_description_list_;
61 std::string binary_name_;
62 std::string process_group_;
63 std::string sched_name_;
64 bool enable_cpuprofile_ = false;
65 std::string profile_filename_;
66 bool enable_heapprofile_ = false;
67 std::string heapprofile_filename_;
68 bool disable_plugin_autoload_ = false;
69};
70
71inline const std::string& ModuleArgument::GetBinaryName() const {
72 return binary_name_;
73}
74
75inline const std::string& ModuleArgument::GetProcessGroup() const {
76 return process_group_;
77}
78
79inline const std::string& ModuleArgument::GetSchedName() const {
80 return sched_name_;
81}
82
83inline const std::list<std::string>& ModuleArgument::GetDAGConfList() const {
84 return dag_conf_list_;
85}
86
87inline const std::list<std::string>& ModuleArgument::GetPluginDescriptionList()
88 const {
89 return plugin_description_list_;
90}
91
93 return disable_plugin_autoload_;
94}
95
96} // namespace mainboard
97} // namespace cyber
98} // namespace apollo
99
100#endif // CYBER_MAINBOARD_MODULE_ARGUMENT_H_
const std::string & GetBinaryName() const
const std::list< std::string > & GetDAGConfList() const
void GetOptions(const int argc, char *const argv[])
const std::string & GetSchedName() const
const std::string & GetProcessGroup() const
void ParseArgument(int argc, char *const argv[])
const std::list< std::string > & GetPluginDescriptionList() const
const std::string GetHeapProfileFilename() const
const std::string GetProfileFilename() const
class register implement
Definition arena_queue.h:37