Skip to content

Commit

Permalink
Merge pull request #3474 from SergioRAgostinho/smart-10
Browse files Browse the repository at this point in the history
Transition to standard smart pointers, part 10
  • Loading branch information
SergioRAgostinho authored Nov 20, 2019
2 parents e109b7f + 6f30c8f commit bc97f0f
Show file tree
Hide file tree
Showing 33 changed files with 130 additions and 110 deletions.
4 changes: 2 additions & 2 deletions common/include/pcl/ModelCoefficients.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const ::pcl::ModelCoefficients>;
}; // struct ModelCoefficients

using ModelCoefficientsPtr = boost::shared_ptr< ::pcl::ModelCoefficients>;
using ModelCoefficientsConstPtr = boost::shared_ptr<const ::pcl::ModelCoefficients>;
using ModelCoefficientsPtr = ModelCoefficients::Ptr;
using ModelCoefficientsConstPtr = ModelCoefficients::ConstPtr;

inline std::ostream& operator<<(std::ostream& s, const ::pcl::ModelCoefficients & v)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/PCLHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const PCLHeader>;
}; // struct PCLHeader

using HeaderPtr = boost::shared_ptr<PCLHeader>;
using HeaderConstPtr = boost::shared_ptr<const PCLHeader>;
using HeaderPtr = PCLHeader::Ptr;
using HeaderConstPtr = PCLHeader::ConstPtr;

inline std::ostream& operator << (std::ostream& out, const PCLHeader &h)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/PCLImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const ::pcl::PCLImage>;
}; // struct PCLImage

using PCLImagePtr = boost::shared_ptr< ::pcl::PCLImage>;
using PCLImageConstPtr = boost::shared_ptr<const ::pcl::PCLImage>;
using PCLImagePtr = PCLImage::Ptr;
using PCLImageConstPtr = PCLImage::ConstPtr;

inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLImage & v)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/PCLPointCloud2.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ namespace pcl
}
}; // struct PCLPointCloud2

using PCLPointCloud2Ptr = boost::shared_ptr< ::pcl::PCLPointCloud2>;
using PCLPointCloud2ConstPtr = boost::shared_ptr<const ::pcl::PCLPointCloud2>;
using PCLPointCloud2Ptr = PCLPointCloud2::Ptr;
using PCLPointCloud2ConstPtr = PCLPointCloud2::ConstPtr;

inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLPointCloud2 &v)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/PCLPointField.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const ::pcl::PCLPointField>;
}; // struct PCLPointField

using PCLPointFieldPtr = boost::shared_ptr< ::pcl::PCLPointField>;
using PCLPointFieldConstPtr = boost::shared_ptr<const ::pcl::PCLPointField>;
using PCLPointFieldPtr = PCLPointField::Ptr;
using PCLPointFieldConstPtr = PCLPointField::ConstPtr;

inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLPointField & v)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/PointIndices.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const ::pcl::PointIndices>;
}; // struct PointIndices

using PointIndicesPtr = boost::shared_ptr< ::pcl::PointIndices>;
using PointIndicesConstPtr = boost::shared_ptr<const ::pcl::PointIndices>;
using PointIndicesPtr = PointIndices::Ptr;
using PointIndicesConstPtr = PointIndices::ConstPtr;

inline std::ostream& operator << (std::ostream& s, const ::pcl::PointIndices &v)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/PolygonMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const ::pcl::PolygonMesh>;
}; // struct PolygonMesh

using PolygonMeshPtr = boost::shared_ptr< ::pcl::PolygonMesh>;
using PolygonMeshConstPtr = boost::shared_ptr<const ::pcl::PolygonMesh>;
using PolygonMeshPtr = PolygonMesh::Ptr;
using PolygonMeshConstPtr = PolygonMesh::ConstPtr;

inline std::ostream& operator<<(std::ostream& s, const ::pcl::PolygonMesh &v)
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/TextureMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ namespace pcl
using ConstPtr = boost::shared_ptr<const pcl::TextureMesh>;
}; // struct TextureMesh

using TextureMeshPtr = boost::shared_ptr<pcl::TextureMesh>;
using TextureMeshConstPtr = boost::shared_ptr<const pcl::TextureMesh>;
using TextureMeshPtr = TextureMesh::Ptr;
using TextureMeshConstPtr = TextureMesh::ConstPtr;
} // namespace pcl
4 changes: 2 additions & 2 deletions common/include/pcl/Vertices.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace pcl
}; // struct Vertices


using VerticesPtr = boost::shared_ptr<Vertices>;
using VerticesConstPtr = boost::shared_ptr<const Vertices>;
using VerticesPtr = Vertices::Ptr;
using VerticesConstPtr = Vertices::ConstPtr;

inline std::ostream& operator<<(std::ostream& s, const ::pcl::Vertices & v)
{
Expand Down
12 changes: 6 additions & 6 deletions common/include/pcl/pcl_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ namespace pcl
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

using PointIndicesPtr = boost::shared_ptr<PointIndices>;
using PointIndicesConstPtr = boost::shared_ptr<PointIndices const>;
using PointIndicesPtr = PointIndices::Ptr;
using PointIndicesConstPtr = PointIndices::ConstPtr;

/** \brief Empty constructor. */
PCLBase ();
Expand Down Expand Up @@ -186,11 +186,11 @@ namespace pcl
{
public:
using PCLPointCloud2 = pcl::PCLPointCloud2;
using PCLPointCloud2Ptr = boost::shared_ptr<PCLPointCloud2>;
using PCLPointCloud2ConstPtr = boost::shared_ptr<PCLPointCloud2 const>;
using PCLPointCloud2Ptr = PCLPointCloud2::Ptr;
using PCLPointCloud2ConstPtr = PCLPointCloud2::ConstPtr;

using PointIndicesPtr = boost::shared_ptr<PointIndices>;
using PointIndicesConstPtr = boost::shared_ptr<PointIndices const>;
using PointIndicesPtr = PointIndices::Ptr;
using PointIndicesConstPtr = PointIndices::ConstPtr;

/** \brief Empty constructor. */
PCLBase ();
Expand Down
9 changes: 5 additions & 4 deletions common/include/pcl/point_cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <pcl/point_traits.h>

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

Expand Down Expand Up @@ -135,7 +136,7 @@ namespace pcl

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

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

protected:
// This is motivated by ROS integration. Users should not need to access mapping_.
boost::shared_ptr<MsgFieldMap> mapping_;
std::shared_ptr<MsgFieldMap> mapping_;

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

public:
PCL_MAKE_ALIGNED_OPERATOR_NEW
};

namespace detail
{
template <typename PointT> boost::shared_ptr<pcl::MsgFieldMap>&
template <typename PointT> std::shared_ptr<pcl::MsgFieldMap>&
getMapping (pcl::PointCloud<PointT>& p)
{
return (p.mapping_);
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/point_representation.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ namespace pcl

public:
// Boost shared pointers
using Ptr = typename boost::shared_ptr<DefaultFeatureRepresentation<PointDefault> >;
using ConstPtr = typename boost::shared_ptr<const DefaultFeatureRepresentation<PointDefault> >;
using Ptr = boost::shared_ptr<DefaultFeatureRepresentation<PointDefault>>;
using ConstPtr = boost::shared_ptr<const DefaultFeatureRepresentation<PointDefault>>;
using FieldList = typename pcl::traits::fieldList<PointDefault>::type;

DefaultFeatureRepresentation ()
Expand Down
2 changes: 2 additions & 0 deletions features/include/pcl/features/integral_image2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ namespace pcl
{
public:
using Ptr = boost::shared_ptr<IntegralImage2D<DataType, Dimension>>;
using ConstPtr = boost::shared_ptr<const IntegralImage2D<DataType, Dimension>>;
static const unsigned second_order_size = (Dimension * (Dimension + 1)) >> 1;
using ElementType = Eigen::Matrix<typename IntegralImageTypeTraits<DataType>::IntegralType, Dimension, 1>;
using SecondOrderType = Eigen::Matrix<typename IntegralImageTypeTraits<DataType>::IntegralType, second_order_size, 1>;
Expand Down Expand Up @@ -232,6 +233,7 @@ namespace pcl
{
public:
using Ptr = boost::shared_ptr<IntegralImage2D<DataType, 1>>;
using ConstPtr = boost::shared_ptr<const IntegralImage2D<DataType, 1>>;

static const unsigned second_order_size = 1;
using ElementType = typename IntegralImageTypeTraits<DataType>::IntegralType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace pcl
using FeatureCloud = pcl::PointCloud<PointFeature>;
using FeatureCloudPtr = typename pcl::PointCloud<PointFeature>::Ptr;
using FeatureEstimatorPtr = typename pcl::Feature<PointSource, PointFeature>::Ptr;
using FeatureRepresentationConstPtr = boost::shared_ptr<const pcl::PointRepresentation<PointFeature> >;
using FeatureRepresentationConstPtr = typename pcl::PointRepresentation<PointFeature>::ConstPtr;

using pcl::PCLBase<PointSource>::input_;

Expand Down
9 changes: 1 addition & 8 deletions filters/include/pcl/filters/conditional_removal.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,7 @@ namespace pcl
}

/** \brief Destructor. */
virtual ~ConditionBase ()
{
// comparisons are boost::shared_ptr.will take care of themselves
comparisons_.clear ();

// conditions are boost::shared_ptr. will take care of themselves
conditions_.clear ();
}
virtual ~ConditionBase () = default;

/** \brief Add a new comparison
* \param comparison the comparison operator to add
Expand Down
4 changes: 2 additions & 2 deletions io/include/pcl/compression/color_coding.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ namespace pcl

// public typedefs
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = boost::shared_ptr<PointCloud>;
using PointCloudConstPtr = boost::shared_ptr<const PointCloud>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

public:

Expand Down
4 changes: 2 additions & 2 deletions io/include/pcl/compression/organized_pointcloud_compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ namespace pcl
{
public:
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = boost::shared_ptr<PointCloud>;
using PointCloudConstPtr = boost::shared_ptr<const PointCloud>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

/** \brief Empty Constructor. */
OrganizedPointCloudCompression ()
Expand Down
4 changes: 2 additions & 2 deletions io/include/pcl/compression/point_coding.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ namespace pcl
{
// public typedefs
using PointCloud = pcl::PointCloud<PointT>;
using PointCloudPtr = boost::shared_ptr<PointCloud>;
using PointCloudConstPtr = boost::shared_ptr<const PointCloud>;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;

public:
/** \brief Constructor. */
Expand Down
1 change: 1 addition & 0 deletions io/include/pcl/io/depth_sense_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace pcl
public:

using Ptr = boost::shared_ptr<DepthSenseGrabber>;
using ConstPtr = boost::shared_ptr<const DepthSenseGrabber>;

using sig_cb_depth_sense_point_cloud = void(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&);
using sig_cb_depth_sense_point_cloud_rgba = void(const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&);
Expand Down
1 change: 1 addition & 0 deletions io/include/pcl/io/image_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ namespace pcl
{
public:
using Ptr = boost::shared_ptr<ImageGrabber>;
using ConstPtr = boost::shared_ptr<const ImageGrabber>;

ImageGrabber (const std::string& dir,
float frames_per_second = 0,
Expand Down
1 change: 1 addition & 0 deletions io/include/pcl/io/image_metadata_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace pcl
{
public:
using Ptr = boost::shared_ptr<FrameWrapper>;
using ConstPtr = boost::shared_ptr<const FrameWrapper>;

virtual
~FrameWrapper() = default;
Expand Down
2 changes: 1 addition & 1 deletion io/include/pcl/io/oni_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace pcl
Synchronizer<openni_wrapper::IRImage::Ptr, openni_wrapper::DepthImage::Ptr > ir_sync_;

/** \brief the actual openni device*/
boost::shared_ptr<openni_wrapper::DeviceONI> device_;
openni_wrapper::DeviceONI::Ptr device_;
std::string rgb_frame_id_;
std::string depth_frame_id_;
bool running_;
Expand Down
33 changes: 18 additions & 15 deletions io/include/pcl/io/openni2/openni2_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@
#include "pcl/io/io_exception.h"

#include <boost/shared_ptr.hpp>
#include <cstdint>
#include <functional>
#include <string>
#include <vector>

// Template frame wrappers
#include <pcl/io/image.h>
#include <pcl/io/image_depth.h>
#include <pcl/io/image_ir.h>

#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <vector>



namespace openni
Expand All @@ -72,6 +74,7 @@ namespace pcl
{
public:
using Ptr = boost::shared_ptr<OpenNI2Device>;
using ConstPtr = boost::shared_ptr<const OpenNI2Device>;

using ImageCallbackFunction = std::function<void(Image::Ptr, void* cookie) >;
using DepthImageCallbackFunction = std::function<void(DepthImage::Ptr, void* cookie) >;
Expand Down Expand Up @@ -272,11 +275,11 @@ namespace pcl
protected:
void shutdown ();

boost::shared_ptr<openni::VideoStream>
std::shared_ptr<openni::VideoStream>
getIRVideoStream () const;
boost::shared_ptr<openni::VideoStream>
std::shared_ptr<openni::VideoStream>
getColorVideoStream () const;
boost::shared_ptr<openni::VideoStream>
std::shared_ptr<openni::VideoStream>
getDepthVideoStream () const;


Expand All @@ -297,16 +300,16 @@ namespace pcl

// Members

boost::shared_ptr<openni::Device> openni_device_;
boost::shared_ptr<openni::DeviceInfo> device_info_;
std::shared_ptr<openni::Device> openni_device_;
std::shared_ptr<openni::DeviceInfo> device_info_;

boost::shared_ptr<OpenNI2FrameListener> ir_frame_listener;
boost::shared_ptr<OpenNI2FrameListener> color_frame_listener;
boost::shared_ptr<OpenNI2FrameListener> depth_frame_listener;
std::shared_ptr<OpenNI2FrameListener> ir_frame_listener;
std::shared_ptr<OpenNI2FrameListener> color_frame_listener;
std::shared_ptr<OpenNI2FrameListener> depth_frame_listener;

mutable boost::shared_ptr<openni::VideoStream> ir_video_stream_;
mutable boost::shared_ptr<openni::VideoStream> color_video_stream_;
mutable boost::shared_ptr<openni::VideoStream> depth_video_stream_;
mutable std::shared_ptr<openni::VideoStream> ir_video_stream_;
mutable std::shared_ptr<openni::VideoStream> color_video_stream_;
mutable std::shared_ptr<openni::VideoStream> depth_video_stream_;

mutable std::vector<OpenNI2VideoMode> ir_video_modes_;
mutable std::vector<OpenNI2VideoMode> color_video_modes_;
Expand Down
Loading

0 comments on commit bc97f0f

Please sign in to comment.