Skip to content

Commit

Permalink
[common] Migrate boost::function to std::function
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRAgostinho committed May 10, 2019
1 parent f9fb3f5 commit 9fc8749
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
1 change: 0 additions & 1 deletion common/include/pcl/common/boost.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <boost/make_shared.hpp>
#include <boost/mpl/size.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include <boost/signals2/slot.hpp>
#include <boost/algorithm/string.hpp>
Expand Down
26 changes: 12 additions & 14 deletions common/include/pcl/common/gaussian.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@

#pragma once

#include <sstream>
#include <pcl/common/eigen.h>
#include <pcl/point_cloud.h>
#include <boost/function.hpp>

#include <sstream>

namespace pcl
{
Expand All @@ -57,8 +57,6 @@ namespace pcl
{
public:

GaussianKernel () {}

static const unsigned MAX_KERNEL_WIDTH = 71;
/** Computes the gaussian kernel and dervative assiociated to sigma.
* The kernel and derivative width are adjusted according.
Expand Down Expand Up @@ -106,9 +104,9 @@ namespace pcl
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
* output.cols () < input.cols () then output is resized to input sizes.
*/
template <typename PointT> void
template <typename PointT, template<typename> class FunctionT> void
convolveRows (const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
FunctionT <float (const PointT& p)> field_accessor,
const Eigen::VectorXf &kernel,
pcl::PointCloud<float> &output) const;

Expand All @@ -132,9 +130,9 @@ namespace pcl
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
* output.cols () < input.cols () then output is resized to input sizes.
*/
template <typename PointT> void
template <typename PointT, template<typename> class FunctionT> void
convolveCols (const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
FunctionT <float (const PointT& p)> field_accessor,
const Eigen::VectorXf &kernel,
pcl::PointCloud<float> &output) const;

Expand Down Expand Up @@ -168,9 +166,9 @@ namespace pcl
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
* output.cols () < input.cols () then output is resized to input sizes.
*/
template <typename PointT> inline void
template <typename PointT, template<typename> class FunctionT> inline void
convolve (const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
FunctionT <float (const PointT& p)> field_accessor,
const Eigen::VectorXf &horiz_kernel,
const Eigen::VectorXf &vert_kernel,
pcl::PointCloud<float> &output) const
Expand Down Expand Up @@ -214,9 +212,9 @@ namespace pcl
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
* output.cols () < input.cols () then output is resized to input sizes.
*/
template <typename PointT> inline void
template <typename PointT, template<typename> class FunctionT> inline void
computeGradients (const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
FunctionT <float (const PointT& p)> field_accessor,
const Eigen::VectorXf &gaussian_kernel,
const Eigen::VectorXf &gaussian_kernel_derivative,
pcl::PointCloud<float> &grad_x,
Expand Down Expand Up @@ -249,9 +247,9 @@ namespace pcl
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
* output.cols () < input.cols () then output is resized to input sizes.
*/
template <typename PointT> inline void
template <typename PointT, template<typename> class FunctionT> inline void
smooth (const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
FunctionT <float (const PointT& p)> field_accessor,
const Eigen::VectorXf &gaussian_kernel,
pcl::PointCloud<float> &output) const
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/common/impl/gaussian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

template <typename PointT> void
pcl::GaussianKernel::convolveRows(const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
std::function <float (const PointT& p)> field_accessor,
const Eigen::VectorXf& kernel,
pcl::PointCloud<float> &output) const
{
Expand Down Expand Up @@ -77,7 +77,7 @@ pcl::GaussianKernel::convolveRows(const pcl::PointCloud<PointT> &input,

template <typename PointT> void
pcl::GaussianKernel::convolveCols(const pcl::PointCloud<PointT> &input,
boost::function <float (const PointT& p)> field_accessor,
std::function <float (const PointT& p)> field_accessor,
const Eigen::VectorXf& kernel,
pcl::PointCloud<float> &output) const
{
Expand Down
4 changes: 2 additions & 2 deletions common/include/pcl/common/synchronizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace pcl
std::deque<T1Stamped> queueT1;
std::deque<T2Stamped> queueT2;

typedef boost::function<void(T1, T2, unsigned long, unsigned long) > CallbackFunction;
typedef std::function<void(T1, T2, unsigned long, unsigned long) > CallbackFunction;

std::map<int, CallbackFunction> cb_;
int callback_counter;
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace pcl

for (typename std::map<int, CallbackFunction>::iterator cb = cb_.begin (); cb != cb_.end (); ++cb)
{
if (!cb->second.empty ())
if (cb->second)
{
cb->second.operator()(queueT1.front ().second, queueT2.front ().second, queueT1.front ().first, queueT2.front ().first);
}
Expand Down
6 changes: 3 additions & 3 deletions common/include/pcl/common/time_trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@

#include <pcl/pcl_macros.h>
#ifndef Q_MOC_RUN
#include <boost/function.hpp>
#include <boost/thread.hpp>
#include <boost/signals2.hpp>
#endif

#include <condition_variable>
#include <functional>
#include <mutex>
#include <thread>

Expand All @@ -57,7 +57,7 @@ namespace pcl
class PCL_EXPORTS TimeTrigger
{
public:
typedef boost::function<void() > callback_type;
typedef std::function<void() > callback_type;

/** \brief Timer class that calls a callback method periodically. Due to possible blocking calls, only one callback method can be registered per instance.
* \param[in] interval_seconds interval in seconds
Expand All @@ -74,7 +74,7 @@ namespace pcl
~TimeTrigger ();

/** \brief registers a callback
* \param[in] callback callback function to the list of callbacks. signature has to be boost::function<void()>
* \param[in] callback callback function to the list of callbacks. signature has to be std::function<void()>
* \return connection the connection, which can be used to disable/enable and remove callback from list
*/
boost::signals2::connection registerCallback (const callback_type& callback);
Expand Down

0 comments on commit 9fc8749

Please sign in to comment.