Apollo 10.0
自动驾驶开放平台
process_result.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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
22
27namespace apollo {
28namespace planning {
29
31 const common::Status& task_status)
32 : task_status_(task_status), stage_status_(stage_status) {}
33
35 return task_status_;
36}
37
39 return stage_status_;
40}
41
43 task_status_ = status;
44 return *this;
45}
46
48 const StageStatusType& stage_status) {
49 stage_status_ = stage_status;
50 return *this;
51}
52
54 const StageStatusType& stage_status, const std::string& message) {
55 stage_status_ = stage_status;
56 task_status_ = common::Status(task_status_.code(), message);
57 return *this;
58}
59
61 return stage_status_ == StageStatusType::ERROR;
62}
63
64bool StageResult::IsTaskError() const { return !task_status_.ok(); }
65
67 const StageStatusType& stage_status,
68 const common::Status& task_status)
69 : scenario_status_(scenario_status),
70 stage_result_(stage_status, task_status) {}
71
73 return stage_result_.GetTaskStatus();
74}
75
77 return stage_result_.GetStageStatus();
78}
79
81 return scenario_status_;
82}
83
85 const StageResult& stage_result) {
86 stage_result_ = stage_result;
87 return *this;
88}
89
91 const StageStatusType& stage_status, const std::string& message) {
92 stage_result_ = StageResult();
93 stage_result_.SetStageStatus(stage_status, message);
94 return *this;
95}
96
98 const ScenarioStatusType& scenario_status) {
99 scenario_status_ = scenario_status;
100 return *this;
101}
102
103} // namespace planning
104} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
bool ok() const
check whether the return status is OK.
Definition status.h:67
ErrorCode code() const
get the error code
Definition status.h:73
const ScenarioResult & SetScenarioStatus(const ScenarioStatusType &scenario_status)
Set the scenario status.
const ScenarioResult & SetStageResult(const StageResult &stage_result)
Set the stage status.
const common::Status & GetTaskStatus() const
Get the task execution result.
const StageStatusType & GetStageStatus() const
Get the stage status.
const ScenarioStatusType & GetScenarioStatus() const
Get the scenario status.
ScenarioResult(const ScenarioStatusType &scenario_status=ScenarioStatusType::STATUS_UNKNOWN, const StageStatusType &stage_status=StageStatusType::READY, const common::Status &task_status=common::Status::OK())
const StageResult & SetStageStatus(const StageStatusType &stage_status)
Set the stage status.
bool HasError() const
Check if StageResult contains error.
StageResult(const StageStatusType &stage_status=StageStatusType::READY, const common::Status &task_status=common::Status::OK())
const StageResult & SetTaskStatus(const common::Status &status)
Set the task execution result.
const StageStatusType & GetStageStatus() const
Get the stage status.
const common::Status & GetTaskStatus() const
Get the task execution result.
Planning module main class.
class register implement
Definition arena_queue.h:37