提交 5a02160c 编写于 作者: D Dong Li 提交者: Jiangtao Hu

planning: fix minor coding practice issues

上级 ba96744c
......@@ -221,13 +221,13 @@ Stage::StageStatus StopSignUnprotectedCreep::Process(
return Stage::FINISHED;
}
auto& reference_line_info = frame->mutable_reference_line_info()->front();
if (static_cast<DeciderCreep*>(FindTask(TaskConfig::DECIDER_CREEP))
if (dynamic_cast<DeciderCreep*>(FindTask(TaskConfig::DECIDER_CREEP))
->CheckCreepDone(frame, &reference_line_info,
GetContext()->next_stop_sign_overlap.end_s)) {
return Stage::FINISHED;
}
// build a stop fence by creep decider
if (static_cast<DeciderCreep*>(FindTask(TaskConfig::DECIDER_CREEP))
if (dynamic_cast<DeciderCreep*>(FindTask(TaskConfig::DECIDER_CREEP))
->Process(frame, &reference_line_info) != Status::OK()) {
ADEBUG << "fail at build stop fence at creeping";
return Stage::ERROR;
......
......@@ -40,11 +40,13 @@
namespace apollo {
namespace planning {
apollo::common::util::Factory<TaskConfig::TaskType, Task,
Task* (*)(const TaskConfig& config)>
apollo::common::util::Factory<
TaskConfig::TaskType, Task, Task* (*)(const TaskConfig& config),
std::unordered_map<TaskConfig::TaskType,
Task* (*)(const TaskConfig& config), std::hash<int>>>
TaskFactory::task_factory_;
std::unordered_map<TaskConfig::TaskType, TaskConfig, EnumHash>
std::unordered_map<TaskConfig::TaskType, TaskConfig, std::hash<int>>
TaskFactory::default_task_configs_;
void TaskFactory::Init(const PlanningConfig& config) {
......
......@@ -32,23 +32,18 @@
namespace apollo {
namespace planning {
struct EnumHash {
template <typename T>
std::size_t operator()(T t) const {
return static_cast<std::size_t>(t);
}
};
class TaskFactory {
public:
static void Init(const PlanningConfig& config);
static void Init(const PlanningConfig &config);
static std::unique_ptr<Task> CreateTask(const TaskConfig &task_config);
private:
static apollo::common::util::Factory<TaskConfig::TaskType, Task,
Task *(*)(const TaskConfig &config)>
static apollo::common::util::Factory<
TaskConfig::TaskType, Task, Task *(*)(const TaskConfig &config),
std::unordered_map<TaskConfig::TaskType,
Task *(*)(const TaskConfig &config), std::hash<int>>>
task_factory_;
static std::unordered_map<TaskConfig::TaskType, TaskConfig, EnumHash>
static std::unordered_map<TaskConfig::TaskType, TaskConfig, std::hash<int>>
default_task_configs_;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册