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

Add pcl::make_shared that automatically handles aligned allocations #3163

Merged
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
7 changes: 4 additions & 3 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/pcl_base.h>
#include <pcl/pcl_macros.h>
#include <pcl/filters/filter.h>
#include <pcl/point_types.h>

Expand All @@ -53,16 +54,16 @@ namespace pcl
float direction;
float magnitude_x;
float magnitude_y;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned
PCL_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned
} EIGEN_ALIGN16; // enforce SSE padding for correct memory alignment

/** \brief A 2D convolution class. */
/** \brief A 2D convolution class. */
template <typename PointT>
class Convolution : public Filter<PointT>
{
public:
using Filter<PointT>::input_;

/**
* Extra pixels are added to the input image so that convolution can be performed over the entire image.
*
Expand Down
3 changes: 2 additions & 1 deletion 2d/include/pcl/2d/edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#pragma once

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

Expand Down Expand Up @@ -298,7 +299,7 @@ namespace pcl
input_ = input;
}

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
}
#include <pcl/2d/impl/edge.hpp>
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/pcl_macros.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/search/kdtree.h>

Expand Down Expand Up @@ -69,7 +70,7 @@ namespace pcl
public:

//This is needed because we have members which are Vector4f and Quaternionf
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW

CloudItem (const QString name,
const pcl::PCLPointCloud2::Ptr cloud_ptr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

#include <limits>

#include <pcl/pcl_macros.h>

namespace pcl
{
namespace ihs
Expand All @@ -56,7 +58,7 @@ namespace pcl
unsigned int age;
uint32_t directions;

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};

struct PointIHS : public pcl::ihs::_PointIHS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#pragma once

#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/apps/in_hand_scanner/boost.h>
#include <pcl/apps/in_hand_scanner/common_types.h>
#include <pcl/apps/in_hand_scanner/opengl_viewer.h>
Expand Down Expand Up @@ -299,8 +300,7 @@ namespace pcl
bool destructor_called_;

public:

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
} // End namespace ihs
} // End namespace pcl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#pragma once

#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/common/time.h>
#include <pcl/apps/in_hand_scanner/common_types.h>
#include <pcl/apps/in_hand_scanner/boost.h>
Expand Down Expand Up @@ -218,8 +219,7 @@ namespace pcl
bool destructor_called_;

public:

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
} // End namespace ihs
} // End namespace pcl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#pragma once

#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/common/time.h>
#include <pcl/apps/in_hand_scanner/boost.h>
#include <pcl/apps/in_hand_scanner/common_types.h>
Expand Down Expand Up @@ -98,8 +99,7 @@ namespace pcl
Eigen::Isometry3d transformation;

public:

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
} // End namespace detail

Expand Down Expand Up @@ -167,8 +167,7 @@ namespace pcl
Eigen::Isometry3d transformation;

public:

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};

/** \brief Constructor. */
Expand Down Expand Up @@ -445,8 +444,7 @@ namespace pcl
int y_prev_;

public:

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
} // End namespace ihs
} // End namespace pcl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <cstdint>

#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>
#include <pcl/apps/in_hand_scanner/eigen.h>

namespace pcl
Expand Down Expand Up @@ -71,8 +72,7 @@ namespace pcl
Vertices vertices_;

public:

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};

PCL_EXPORTS void
Expand Down
1 change: 1 addition & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ set(incs
include/pcl/PointIndices.h
include/pcl/register_point_struct.h
include/pcl/conversions.h
include/pcl/make_shared.h
)

set(common_incs
Expand Down
3 changes: 2 additions & 1 deletion 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/pcl_macros.h>
#include <pcl/point_cloud.h>
#include <pcl/point_traits.h>
#include <pcl/PointIndices.h>
Expand Down Expand Up @@ -1050,7 +1051,7 @@ namespace pcl
return (num_points_);
}

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW

private:

Expand Down
5 changes: 3 additions & 2 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/pcl_macros.h>
#include <pcl/point_types.h>

namespace pcl
Expand Down Expand Up @@ -80,7 +81,7 @@ namespace pcl
template <typename PointT> void
get (PointT& t, size_t n) const { t.getVector3fMap () = xyz / n; }

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW

};

Expand Down Expand Up @@ -113,7 +114,7 @@ namespace pcl
#endif
}

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW

};

Expand Down
2 changes: 1 addition & 1 deletion common/include/pcl/common/poses_from_matches.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace pcl
bool operator()(const PoseEstimate& pe1, const PoseEstimate& pe2) const { return pe1.score>pe2.score;}
};
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};

// =====TYPEDEFS=====
Expand Down
3 changes: 2 additions & 1 deletion 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/pcl_macros.h>
#include <pcl/common/eigen.h>

namespace pcl
Expand Down Expand Up @@ -96,7 +97,7 @@ namespace pcl
inline void
getEigenVector1 (Eigen::Matrix<real, dimension, 1>& eigen_vector1) const;

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW

//-----VARIABLES-----

Expand Down
11 changes: 6 additions & 5 deletions common/include/pcl/correspondence.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <pcl/pcl_exports.h>
#include <pcl/pcl_macros.h>

namespace pcl
{
Expand Down Expand Up @@ -82,10 +83,10 @@ namespace pcl

/** \brief Empty destructor. */
virtual ~Correspondence () {}
EIGEN_MAKE_ALIGNED_OPERATOR_NEW

PCL_MAKE_ALIGNED_OPERATOR_NEW
};

/** \brief overloaded << operator */
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Correspondence& c);

Expand Down Expand Up @@ -128,7 +129,7 @@ namespace pcl
/** \brief Empty destructor. */
virtual ~PointCorrespondence3D () {}

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
using PointCorrespondences3DVector = std::vector<PointCorrespondence3D, Eigen::aligned_allocator<PointCorrespondence3D> >;

Expand All @@ -144,7 +145,7 @@ namespace pcl
/** \brief Empty destructor. */
virtual ~PointCorrespondence6D () {}

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
using PointCorrespondences6DVector = std::vector<PointCorrespondence6D, Eigen::aligned_allocator<PointCorrespondence6D> >;

Expand Down
Loading