From b3e2df6bfff4a2cd69d45c71c725b05a4953e7d4 Mon Sep 17 00:00:00 2001 From: Zhang Liangliang Date: Wed, 19 Jul 2017 14:08:08 -0700 Subject: [PATCH] added speed_limit.h/cc --- modules/planning/common/BUILD | 14 ++++++++ modules/planning/common/speed_limit.cc | 35 ++++++++++++++++++++ modules/planning/common/speed_limit.h | 44 ++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 modules/planning/common/speed_limit.cc create mode 100644 modules/planning/common/speed_limit.h diff --git a/modules/planning/common/BUILD b/modules/planning/common/BUILD index fa9987b82f..f406d2f9e5 100644 --- a/modules/planning/common/BUILD +++ b/modules/planning/common/BUILD @@ -38,6 +38,20 @@ cc_library( ], ) +cc_library( + name = "speed_limit", + srcs = [ + "speed_limit.cc", + ], + hdrs = [ + "speed_limit.h", + ], + deps = [ + "//modules/common/math", + "//modules/planning/common/speed:speed", + ], +) + cc_library( name = "lib_planning_common", deps = [ diff --git a/modules/planning/common/speed_limit.cc b/modules/planning/common/speed_limit.cc new file mode 100644 index 0000000000..98bc5f63d7 --- /dev/null +++ b/modules/planning/common/speed_limit.cc @@ -0,0 +1,35 @@ +/****************************************************************************** + * Copyright 2017 The Apollo Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +/** + * @file speed_limit.cc + **/ + +#include "modules/planning/common/speed_limit.h" + +namespace apollo { +namespace planning { + +std::vector* SpeedLimit::mutable_speed_limits() { + return &_speed_point; +} + +const std::vector& SpeedLimit::speed_limits() const { + return _speed_point; +} + +} // namespace planning +} // namespace apollo diff --git a/modules/planning/common/speed_limit.h b/modules/planning/common/speed_limit.h new file mode 100644 index 0000000000..d6fd9ddef6 --- /dev/null +++ b/modules/planning/common/speed_limit.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright 2017 The Apollo Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *****************************************************************************/ + +/** + * @file speed_limit.h + **/ + +#include + +#include "modules/planning/common/speed/speed_point.h" + +#ifndef MODULES_PLANNING_COMMON_SPEED_LIMIT_H_ +#define MODULES_PLANNING_COMMON_SPEED_LIMIT_H_ + +namespace apollo { +namespace planning { + +class SpeedLimit { + public: + SpeedLimit() = default; + std::vector* mutable_speed_limits(); + const std::vector& speed_limits() const; + + private: + std::vector _speed_point; +}; + +} // namespace planning +} // namespace apollo + +#endif // MODULES_PLANNING_COMMON_SPEED_LIMIT_H_ -- GitLab