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

purge functions that returns mutable vector (#136)

上级 1481c2b5
...@@ -67,9 +67,5 @@ void Obstacle::add_prediction_trajectory( ...@@ -67,9 +67,5 @@ void Obstacle::add_prediction_trajectory(
prediction_trajectories_.push_back(prediction_trajectory); prediction_trajectories_.push_back(prediction_trajectory);
} }
std::vector<PredictionTrajectory>* Obstacle::mutable_prediction_trajectories() {
return &prediction_trajectories_;
}
} // namespace planning } // namespace planning
} // namespace apollo } // namespace apollo
...@@ -71,7 +71,6 @@ class Obstacle : public PlanningObject { ...@@ -71,7 +71,6 @@ class Obstacle : public PlanningObject {
const std::vector<PredictionTrajectory> &prediction_trajectories() const; const std::vector<PredictionTrajectory> &prediction_trajectories() const;
void add_prediction_trajectory( void add_prediction_trajectory(
const PredictionTrajectory &prediction_trajectory); const PredictionTrajectory &prediction_trajectory);
std::vector<PredictionTrajectory> *mutable_prediction_trajectories();
private: private:
std::string id_ = 0; std::string id_ = 0;
......
...@@ -174,7 +174,7 @@ bool CubicSpiralCurve::calculate_path() { ...@@ -174,7 +174,7 @@ bool CubicSpiralCurve::calculate_path() {
ds = sg / (spiral_config().simpson_size() - 1); ds = sg / (spiral_config().simpson_size() - 1);
} }
std::copy(p_shoot.begin(), p_shoot.end(), (*mutable_p_params()).begin()); prepend_to_p_params(p_shoot.begin(), p_shoot.end());
set_sg(sg); set_sg(sg);
set_error(diff); set_error(diff);
......
...@@ -185,7 +185,7 @@ bool QuinticSpiralCurve::calculate_path() { ...@@ -185,7 +185,7 @@ bool QuinticSpiralCurve::calculate_path() {
} }
// update params // update params
std::copy(p_shoot.begin(), p_shoot.end(), (*mutable_p_params()).begin()); prepend_to_p_params(p_shoot.begin(), p_shoot.end());
set_sg(sg); set_sg(sg);
set_error(diff); set_error(diff);
......
...@@ -57,8 +57,6 @@ const SpiralCurveConfig& SpiralCurve::spiral_config() const { ...@@ -57,8 +57,6 @@ const SpiralCurveConfig& SpiralCurve::spiral_config() const {
return spiral_config_; return spiral_config_;
} }
std::vector<double>* SpiralCurve::mutable_p_params() { return &p_params_; }
void SpiralCurve::set_sg(const double sg) { sg_ = sg; } void SpiralCurve::set_sg(const double sg) { sg_ = sg; }
void SpiralCurve::set_error(const double error) { error_ = error; } void SpiralCurve::set_error(const double error) { error_ = error; }
......
...@@ -84,10 +84,13 @@ class SpiralCurve { ...@@ -84,10 +84,13 @@ class SpiralCurve {
SpiralCurveConfig spiral_config_; SpiralCurveConfig spiral_config_;
protected: protected:
std::vector<double>* mutable_p_params();
void set_sg(const double sg); void set_sg(const double sg);
void set_error(const double error); void set_error(const double error);
bool result_sanity_check() const; bool result_sanity_check() const;
template <typename T>
void prepend_to_p_params(T begin, T end) {
std::copy(begin, end, p_params_.begin());
}
static constexpr double s_two_pi_ = 2 * M_PI; static constexpr double s_two_pi_ = 2 * M_PI;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册