提交 13a7c902 编写于 作者: Z Zhang Liangliang 提交者: Jiangtao Hu

Perception: removed unsafe element wise copy constructor/functions.

上级 e427f36b
......@@ -21,8 +21,6 @@
namespace apollo {
namespace perception {
TrackedObject::TrackedObject() {}
TrackedObject::TrackedObject(ObjectPtr obj_ptr) : object_ptr(obj_ptr) {
if (object_ptr != nullptr) {
barycenter = GetCloudBarycenter<apollo::perception::pcl_util::Point>(
......@@ -40,52 +38,10 @@ TrackedObject::TrackedObject(ObjectPtr obj_ptr) : object_ptr(obj_ptr) {
}
}
TrackedObject::TrackedObject(const TrackedObject& rhs) {
object_ptr = rhs.object_ptr;
center = rhs.center;
direction = rhs.direction;
lane_direction = rhs.lane_direction;
size = rhs.size;
type = rhs.type;
barycenter = rhs.barycenter;
anchor_point = rhs.anchor_point;
velocity = rhs.velocity;
acceleration = rhs.acceleration;
type = rhs.type;
association_score = rhs.association_score;
}
TrackedObject& TrackedObject::operator=(const TrackedObject& rhs) {
object_ptr = rhs.object_ptr;
center = rhs.center;
direction = rhs.direction;
lane_direction = rhs.lane_direction;
size = rhs.size;
type = rhs.type;
barycenter = rhs.barycenter;
anchor_point = rhs.anchor_point;
velocity = rhs.velocity;
acceleration = rhs.acceleration;
type = rhs.type;
association_score = rhs.association_score;
return (*this);
}
void TrackedObject::clone(const TrackedObject& rhs) {
*this = rhs;
object_ptr.reset(new Object());
object_ptr->clone(*rhs.object_ptr);
center = rhs.center;
direction = rhs.direction;
lane_direction = rhs.lane_direction;
size = rhs.size;
type = rhs.type;
barycenter = rhs.barycenter;
anchor_point = rhs.anchor_point;
velocity = rhs.velocity;
acceleration = rhs.acceleration;
type = rhs.type;
association_score = rhs.association_score;
}
} // namespace perception
......
......@@ -14,8 +14,8 @@
* limitations under the License.
*****************************************************************************/
#ifndef MODULES_PERCEPTION_OBSTACLE_LIDAR_TRACKER_HM_TRACKER_TRACKED_OBJ_H_
#define MODULES_PERCEPTION_OBSTACLE_LIDAR_TRACKER_HM_TRACKER_TRACKED_OBJ_H_
#ifndef MODULES_PERCEPTION_OBSTACLE_LIDAR_TRACKER_HM_TRACKER_TRACKED_OBJECT_H_
#define MODULES_PERCEPTION_OBSTACLE_LIDAR_TRACKER_HM_TRACKER_TRACKED_OBJECT_H_
#include <memory>
#include <string>
......@@ -31,10 +31,10 @@ struct TrackedObject {
/* NEED TO NOTICE: All the states of track would be collected mainly based on
* the states of tracked object. Thus, update tracked object's state when you
* update the state of track !!! */
TrackedObject();
TrackedObject() = default;
explicit TrackedObject(ObjectPtr obj_ptr);
TrackedObject(const TrackedObject& rhs);
TrackedObject& operator=(const TrackedObject& rhs);
// deep copy (copy point clonds)
void clone(const TrackedObject& rhs);
// cloud
......@@ -68,4 +68,4 @@ typedef std::shared_ptr<const TrackedObject> TrackedObjectConstPtr;
} // namespace perception
} // namespace apollo
#endif // MODULES_PERCEPTION_OBSTACLE_LIDAR_TRACKER_HM_TRACKER_TRACKED_OBJ_H_
#endif // MODULES_PERCEPTION_OBSTACLE_LIDAR_TRACKER_HM_TRACKER_TRACKED_OBJECT_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册