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

Deprecate pcl/make_shared.h header; extract PCL_MAKE_ALIGNED_OPERATOR_NEW into pcl/memory.h #3654

Merged
merged 2 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 2d/include/pcl/2d/convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#pragma once

#include <pcl/filters/filter.h>
#include <pcl/memory.h>
#include <pcl/pcl_base.h>
#include <pcl/pcl_macros.h>
#include <pcl/point_types.h>
Expand Down
1 change: 1 addition & 0 deletions 2d/include/pcl/2d/edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <pcl/2d/convolution.h>
#include <pcl/2d/kernel.h>
#include <pcl/memory.h>
#include <pcl/pcl_base.h>
#include <pcl/pcl_macros.h>

Expand Down
2 changes: 1 addition & 1 deletion apps/3d_rec_framework/src/tools/openni_frame_source.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "pcl/apps/3d_rec_framework/tools/openni_frame_source.h"
#include <pcl/io/pcd_io.h>
#include <pcl/make_shared.h>
#include <pcl/memory.h>

namespace OpenNIFrameSource
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <QDebug>

#include <pcl/apps/cloud_composer/items/cloud_composer_item.h>
#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/search/kdtree.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <pcl/apps/cloud_composer/tools/supervoxels.h>
#include <pcl/apps/cloud_composer/impl/cloud_item.hpp>
#include <pcl/apps/cloud_composer/items/normals_item.h>
#include <pcl/make_shared.h>
#include <pcl/memory.h>
#include <pcl/point_cloud.h>
#include <pcl/segmentation/supervoxel_clustering.h>

Expand Down
2 changes: 1 addition & 1 deletion apps/cloud_composer/src/project_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <pcl/apps/cloud_composer/cloud_view.h>
#include <pcl/apps/cloud_composer/merge_selection.h>
#include <pcl/apps/cloud_composer/transform_clouds.h>
#include <pcl/make_shared.h>
#include <pcl/memory.h>

#include <QAction>
#include <QFileDialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include <limits>

#include <pcl/memory.h>
#include <pcl/pcl_macros.h>

namespace pcl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#pragma once

#include <pcl/memory.h>
#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/apps/in_hand_scanner/boost.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#pragma once

#include <pcl/memory.h>
#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/common/time.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#pragma once

#include <pcl/memory.h>
#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/common/time.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#include <cstdint>

#include <pcl/memory.h>
#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/apps/in_hand_scanner/eigen.h>
Expand Down
2 changes: 1 addition & 1 deletion apps/src/face_detection/openni_frame_source.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "pcl/apps/face_detection/openni_frame_source.h"
#include <pcl/io/pcd_io.h>
#include <pcl/make_shared.h>
#include <pcl/memory.h>

namespace OpenNIFrameSource
{
Expand Down
2 changes: 1 addition & 1 deletion apps/src/multiscale_feature_persistence_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <pcl/features/fpfh.h>

#include <pcl/visualization/cloud_viewer.h>
#include <pcl/make_shared.h>
#include <pcl/memory.h>

using namespace pcl;

Expand Down
1 change: 1 addition & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ set(srcs

set(incs
include/pcl/correspondence.h
include/pcl/memory.h
include/pcl/exceptions.h
include/pcl/pcl_base.h
include/pcl/pcl_exports.h
Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/PCLHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string> // for string
#include <ostream> // for ostream

#include <pcl/make_shared.h> // for shared_ptr
#include <pcl/memory.h> // for shared_ptr

namespace pcl
{
Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/PCLPointCloud2.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <boost/predef/other/endian.h>

#include <pcl/pcl_macros.h> // for PCL_EXPORTS
#include <pcl/PCLHeader.h>
#include <pcl/PCLPointField.h>

Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/PCLPointField.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string> // for string
#include <ostream> // for ostream

#include <pcl/pcl_macros.h> // for shared_ptr
#include <pcl/memory.h> // for shared_ptr

namespace pcl
{
Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/Vertices.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <ostream>
#include <boost/shared_ptr.hpp>
#include <pcl/memory.h>
#include <pcl/pcl_macros.h>

namespace pcl
Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/common/centroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#pragma once

#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
#include <pcl/point_cloud.h>
#include <pcl/point_traits.h>
Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/common/impl/accumulators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <boost/fusion/include/as_vector.hpp>
#include <boost/fusion/include/filter_if.hpp>

#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
#include <pcl/point_types.h>

Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/common/poses_from_matches.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#pragma once

#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
#include <pcl/correspondence.h>

Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/common/vector_average.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#pragma once

#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
#include <pcl/common/eigen.h>

Expand Down
12 changes: 6 additions & 6 deletions common/include/pcl/correspondence.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@
#pragma once

#ifdef __GNUC__
#pragma GCC system_header
#pragma GCC system_header
#endif

#include <pcl/make_shared.h>
#include <pcl/memory.h>
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>

namespace pcl
{
/** \brief Correspondence represents a match between two entities (e.g., points, descriptors, etc). This is
/** \brief Correspondence represents a match between two entities (e.g., points, descriptors, etc). This is
* represented via the indices of a \a source point and a \a target point, and the distance between them.
*
* \author Dirk Holz, Radu B. Rusu, Bastian Steder
Expand All @@ -68,14 +68,14 @@ namespace pcl
float distance = std::numeric_limits<float>::max();
float weight;
};
/** \brief Standard constructor.

/** \brief Standard constructor.
* Sets \ref index_query to 0, \ref index_match to -1, and \ref distance to FLT_MAX.
*/
inline Correspondence () = default;

/** \brief Constructor. */
inline Correspondence (int _index_query, int _index_match, float _distance) :
inline Correspondence (int _index_query, int _index_match, float _distance) :
index_query (_index_query), index_match (_index_match), distance (_distance)
{}

Expand Down
1 change: 1 addition & 0 deletions common/include/pcl/impl/point_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

#include <Eigen/Core>

#include <pcl/memory.h>
#include <pcl/pcl_macros.h>

// Define all PCL point types
Expand Down
49 changes: 2 additions & 47 deletions common/include/pcl/make_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,10 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

#pragma once

#warning "Do not use this header, its contents have been moved to pcl/memory.h"

#include <type_traits>
#include <utility>

#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>

#include <pcl/point_traits.h>


namespace pcl
{

#ifdef DOXYGEN_ONLY

/**
* \brief Returns a pcl::shared_ptr compliant with type T's allocation policy.
*
* boost::allocate_shared or boost::make_shared will be invoked in case T has or
* doesn't have a custom allocator, respectively.
*
* \see pcl::has_custom_allocator, PCL_MAKE_ALIGNED_OPERATOR_NEW
* \tparam T Type of the object to create a pcl::shared_ptr of
* \tparam Args Types for the arguments to pcl::make_shared
* \param args List of arguments with which an instance of T will be constructed
* \return pcl::shared_ptr of an instance of type T
*/
template<typename T, typename ... Args>
shared_ptr<T> make_shared(Args&&... args);

#else

template<typename T, typename ... Args>
std::enable_if_t<has_custom_allocator<T>::value, shared_ptr<T>> make_shared(Args&&... args)
{
return boost::allocate_shared<T>(Eigen::aligned_allocator<T>(), std::forward<Args> (args)...);
}

template<typename T, typename ... Args>
std::enable_if_t<!has_custom_allocator<T>::value, shared_ptr<T>> make_shared(Args&&... args)
{
return boost::make_shared<T>(std::forward<Args> (args)...);
}

#endif

} // namespace pcl
#include <pcl/memory.h>
Loading