Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcl::PCLHeader is not swapped in pcl::PointCloud::swap #2470

Closed
csukuangfj opened this issue Sep 26, 2018 · 2 comments
Closed

pcl::PCLHeader is not swapped in pcl::PointCloud::swap #2470

csukuangfj opened this issue Sep 26, 2018 · 2 comments

Comments

@csukuangfj
Copy link
Contributor

Your Environment

  • PCL Version: master branch

Context

See the code

pcl::PCLHeader header;

swap (PointCloud<PointT> &rhs)
{
this->points.swap (rhs.points);
std::swap (width, rhs.width);
std::swap (height, rhs.height);
std::swap (is_dense, rhs.is_dense);
std::swap (sensor_origin_, rhs.sensor_origin_);
std::swap (sensor_orientation_, rhs.sensor_orientation_);
}

In addition, the same goes to

boost::shared_ptr<MsgFieldMap> mapping_;

Expected Behavior

All data members including header and mapping_ should be swapped.

Current Behavior

header and mapping_ are missing.

Code to Reproduce

See the code above.

Possible Solution

Swap header and mapping_.

@taketwo
Copy link
Member

taketwo commented Sep 30, 2018

👍 for swapping header. I'm not sure what's the purpose of the mapping field, seems like unused legacy code to me.

@csukuangfj
Copy link
Contributor Author

@taketwo
It seems that mapping_ is used only by

namespace detail
{
template <typename PointT> boost::shared_ptr<pcl::MsgFieldMap>&
getMapping (pcl::PointCloud<PointT>& p)
{
return (p.mapping_);
}
} // namespace detail

But getMapping() is never used in the project, so mapping_ does not need to be swapped.

PS: mapping_ and getMapping() might be removed from the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants