Skip to content

Commit

Permalink
Revert smart pointer type change and deprecate getMapping()
Browse files Browse the repository at this point in the history
Even though pcl::detail::getMapping() is not officially a public API, it
is used outside of PCL (in pcl_ros). Changing the smart pointer type
from boost to std broke that code.

This commit partially reverses the changes from #3474, unbreaking
pcl_ros. It also properly deprecates the function so that other (unknown
to us) clients have time to update their code.
  • Loading branch information
taketwo committed Jan 17, 2020
1 parent 35fb624 commit 794c586
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions common/include/pcl/point_cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
#include <pcl/pcl_macros.h>
#include <pcl/point_traits.h>

#include <boost/shared_ptr.hpp>

#include <algorithm>
#include <memory>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -136,7 +137,9 @@ namespace pcl

namespace detail
{
template <typename PointT> std::shared_ptr<pcl::MsgFieldMap>&
template <typename PointT>
[[deprecated("use createMapping() instead")]]
boost::shared_ptr<pcl::MsgFieldMap>&
getMapping (pcl::PointCloud<PointT>& p);
} // namespace detail

Expand Down Expand Up @@ -603,17 +606,17 @@ namespace pcl

protected:
// This is motivated by ROS integration. Users should not need to access mapping_.
std::shared_ptr<MsgFieldMap> mapping_;
[[deprecated("rewrite your code to avoid using this protected field")]] boost::shared_ptr<MsgFieldMap> mapping_;

friend std::shared_ptr<MsgFieldMap>& detail::getMapping<PointT>(pcl::PointCloud<PointT> &p);
friend boost::shared_ptr<MsgFieldMap>& detail::getMapping<PointT>(pcl::PointCloud<PointT> &p);

public:
PCL_MAKE_ALIGNED_OPERATOR_NEW
};

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

0 comments on commit 794c586

Please sign in to comment.