diff --git a/tools/davidsdk_viewer.cpp b/tools/davidsdk_viewer.cpp index a6590a768a5..56874114de2 100644 --- a/tools/davidsdk_viewer.cpp +++ b/tools/davidsdk_viewer.cpp @@ -93,8 +93,7 @@ main (int argc, //davidsdk_ptr->setFileFormatToPLY(); std::cout << "Using " << davidsdk_ptr->getFileFormat () << " file format" << std::endl; - std::function f = boost::bind (&grabberCallback, _1); + std::function f = [] (const PointCloudXYZ::Ptr& cloud) { grabberCallback (cloud); }; davidsdk_ptr->registerCallback (f); davidsdk_ptr->start (); diff --git a/tools/depth_sense_viewer.cpp b/tools/depth_sense_viewer.cpp index 257eb6c521e..f3f97790fa8 100644 --- a/tools/depth_sense_viewer.cpp +++ b/tools/depth_sense_viewer.cpp @@ -140,7 +140,10 @@ class DepthSenseViewer void run () { - std::function f = boost::bind (&DepthSenseViewer::cloudCallback, this, _1); + std::function f = [this] (const typename PointCloudT::ConstPtr& cloud) + { + cloudCallback (cloud); + }; connection_ = grabber_.registerCallback (f); grabber_.start (); while (!viewer_.wasStopped ()) diff --git a/tools/ensenso_viewer.cpp b/tools/ensenso_viewer.cpp index e1642abb6f8..a31ee10d9cb 100644 --- a/tools/ensenso_viewer.cpp +++ b/tools/ensenso_viewer.cpp @@ -76,8 +76,7 @@ main (void) ensenso_ptr->openTcpPort (); ensenso_ptr->openDevice (); - std::function f = boost::bind (&grabberCallback, _1); + std::function f = [] (const PointCloudXYZ::Ptr& cloud) { grabberCallback (cloud); }; ensenso_ptr->registerCallback (f); ensenso_ptr->start (); diff --git a/tools/hdl_viewer_simple.cpp b/tools/hdl_viewer_simple.cpp index 64b220db0db..94d3bd66525 100644 --- a/tools/hdl_viewer_simple.cpp +++ b/tools/hdl_viewer_simple.cpp @@ -148,8 +148,7 @@ class SimpleHDLViewer cloud_viewer_->setCameraPosition (0.0, 0.0, 30.0, 0.0, 1.0, 0.0, 0); cloud_viewer_->setCameraClipDistances (0.0, 50.0); - std::function cloud_cb = boost::bind ( - &SimpleHDLViewer::cloud_callback, this, _1); + std::function cloud_cb = [this] (const CloudConstPtr& cloud) { cloud_callback (cloud); }; boost::signals2::connection cloud_connection = grabber_.registerCallback ( cloud_cb); diff --git a/tools/image_grabber_saver.cpp b/tools/image_grabber_saver.cpp index cf0d4d380ca..ec5f5309536 100644 --- a/tools/image_grabber_saver.cpp +++ b/tools/image_grabber_saver.cpp @@ -133,7 +133,10 @@ main (int argc, char** argv) //grabber->setFocalLength(focal_length); // FIXME EventHelper h; - std::function::ConstPtr&) > f = boost::bind (&EventHelper::cloud_cb, &h, _1); + std::function::ConstPtr&) > f = [&] (const pcl::PointCloud::ConstPtr& cloud) + { + h.cloud_cb (cloud); + }; boost::signals2::connection c1 = grabber->registerCallback (f); do diff --git a/tools/image_grabber_viewer.cpp b/tools/image_grabber_viewer.cpp index 2ba98e5c230..8d4a20ba16b 100644 --- a/tools/image_grabber_viewer.cpp +++ b/tools/image_grabber_viewer.cpp @@ -222,7 +222,10 @@ main (int argc, char** argv) EventHelper h; - std::function::ConstPtr&) > f = boost::bind (&EventHelper::cloud_cb, &h, _1); + std::function::ConstPtr&) > f = [&] (const pcl::PointCloud::ConstPtr & cloud) + { + h.cloud_cb (cloud); + }; boost::signals2::connection c1 = grabber->registerCallback (f); std::string mouse_msg_3D ("Mouse coordinates in PCL Visualizer"); diff --git a/tools/oni2pcd.cpp b/tools/oni2pcd.cpp index 5e464b5355e..7af44788eca 100644 --- a/tools/oni2pcd.cpp +++ b/tools/oni2pcd.cpp @@ -83,7 +83,7 @@ main (int argc, char **argv) } pcl::ONIGrabber* grabber = new pcl::ONIGrabber (argv[1], false, false); - std::function f = boost::bind (&cloud_cb, _1); + std::function f = [] (const CloudConstPtr& cloud) { cloud_cb (cloud); }; boost::signals2::connection c = grabber->registerCallback (f); while (grabber->hasDataLeft ()) diff --git a/tools/oni_viewer_simple.cpp b/tools/oni_viewer_simple.cpp index 9fecba449a2..9c3a2af7599 100644 --- a/tools/oni_viewer_simple.cpp +++ b/tools/oni_viewer_simple.cpp @@ -122,7 +122,7 @@ class SimpleONIViewer { //pcl::Grabber* interface = new pcl::OpenNIGrabber(device_id_, pcl::OpenNIGrabber::OpenNI_QQVGA_30Hz, pcl::OpenNIGrabber::OpenNI_VGA_30Hz); - std::function f = boost::bind (&SimpleONIViewer::cloud_cb_, this, _1); + std::function f = [this] (const CloudConstPtr& cloud) { cloud_cb_ (cloud); }; boost::signals2::connection c = grabber_.registerCallback (f); @@ -192,7 +192,7 @@ main(int argc, char ** argv) { grabber = new pcl::ONIGrabber(arg, true, false); trigger.setInterval (1.0 / static_cast (frame_rate)); - trigger.registerCallback (boost::bind(&pcl::ONIGrabber::start, grabber)); + trigger.registerCallback ([=] { grabber->start (); }); trigger.start(); } if (grabber->providesCallback () && !pcl::console::find_switch (argc, argv, "-xyz")) diff --git a/tools/openni2_viewer.cpp b/tools/openni2_viewer.cpp index 5a2a16a96bc..836382daab8 100644 --- a/tools/openni2_viewer.cpp +++ b/tools/openni2_viewer.cpp @@ -177,7 +177,7 @@ class OpenNI2Viewer cloud_viewer_->registerMouseCallback (&OpenNI2Viewer::mouse_callback, *this); cloud_viewer_->registerKeyboardCallback (&OpenNI2Viewer::keyboard_callback, *this); cloud_viewer_->setCameraFieldOfView (1.02259994f); - std::function cloud_cb = boost::bind (&OpenNI2Viewer::cloud_callback, this, _1); + std::function cloud_cb = [this] (const CloudConstPtr& cloud) { cloud_callback (cloud); }; boost::signals2::connection cloud_connection = grabber_.registerCallback (cloud_cb); boost::signals2::connection image_connection; @@ -186,7 +186,7 @@ class OpenNI2Viewer image_viewer_.reset (new pcl::visualization::ImageViewer ("PCL OpenNI image")); image_viewer_->registerMouseCallback (&OpenNI2Viewer::mouse_callback, *this); image_viewer_->registerKeyboardCallback (&OpenNI2Viewer::keyboard_callback, *this); - std::function&) > image_cb = boost::bind (&OpenNI2Viewer::image_callback, this, _1); + std::function image_cb = [this] (const pcl::io::openni2::Image::Ptr& img) { image_callback (img); }; image_connection = grabber_.registerCallback (image_cb); } diff --git a/tools/openni_image.cpp b/tools/openni_image.cpp index 7dc51fab80f..5d3c4b3aa9d 100644 --- a/tools/openni_image.cpp +++ b/tools/openni_image.cpp @@ -414,7 +414,12 @@ class Driver void grabAndSend () { - std::function&, const boost::shared_ptr&, float) > image_cb = boost::bind (&Driver::image_callback, this, _1, _2, _3); + std::function< + void (const openni_wrapper::Image::Ptr&, const openni_wrapper::DepthImage::Ptr&, float) + > image_cb = [this] (const openni_wrapper::Image::Ptr& img, const openni_wrapper::DepthImage::Ptr& depth, float f) + { + image_callback (img, depth, f); + }; boost::signals2::connection image_connection = grabber_.registerCallback (image_cb); grabber_.start (); diff --git a/tools/openni_save_image.cpp b/tools/openni_save_image.cpp index bfd7d24fcf8..7ec739a2d23 100644 --- a/tools/openni_save_image.cpp +++ b/tools/openni_save_image.cpp @@ -104,7 +104,12 @@ class SimpleOpenNIViewer void run () { - std::function image_cb = boost::bind (&SimpleOpenNIViewer::image_callback, this, _1, _2, _3); + std::function< + void (const openni_wrapper::Image::Ptr&, const openni_wrapper::DepthImage::Ptr&, float) + > image_cb = [this] (const openni_wrapper::Image::Ptr& img, const openni_wrapper::DepthImage::Ptr& depth, float f) + { + image_callback (img, depth, f); + }; boost::signals2::connection image_connection = grabber_.registerCallback (image_cb); grabber_.start (); diff --git a/tools/openni_viewer.cpp b/tools/openni_viewer.cpp index c00a5eb4138..f39b3565366 100644 --- a/tools/openni_viewer.cpp +++ b/tools/openni_viewer.cpp @@ -174,7 +174,7 @@ class OpenNIViewer { cloud_viewer_->registerMouseCallback (&OpenNIViewer::mouse_callback, *this); cloud_viewer_->registerKeyboardCallback(&OpenNIViewer::keyboard_callback, *this); - std::function cloud_cb = boost::bind (&OpenNIViewer::cloud_callback, this, _1); + std::function cloud_cb = [this] (const CloudConstPtr& cloud) { cloud_callback (cloud); }; boost::signals2::connection cloud_connection = grabber_.registerCallback (cloud_cb); boost::signals2::connection image_connection; @@ -183,7 +183,7 @@ class OpenNIViewer image_viewer_.reset (new pcl::visualization::ImageViewer ("PCL OpenNI image")); image_viewer_->registerMouseCallback (&OpenNIViewer::mouse_callback, *this); image_viewer_->registerKeyboardCallback(&OpenNIViewer::keyboard_callback, *this); - std::function&) > image_cb = boost::bind (&OpenNIViewer::image_callback, this, _1); + std::function image_cb = [this] (const openni_wrapper::Image::Ptr& img) { image_callback (img); }; image_connection = grabber_.registerCallback (image_cb); } diff --git a/tools/openni_viewer_simple.cpp b/tools/openni_viewer_simple.cpp index 41aee029e20..b6f1ece79f4 100644 --- a/tools/openni_viewer_simple.cpp +++ b/tools/openni_viewer_simple.cpp @@ -172,7 +172,7 @@ class SimpleOpenNIViewer string keyMsg3D("Key event for PCL Visualizer"); cloud_viewer_.registerMouseCallback (&SimpleOpenNIViewer::mouse_callback, *this, (void*)(&mouseMsg3D)); cloud_viewer_.registerKeyboardCallback(&SimpleOpenNIViewer::keyboard_callback, *this, (void*)(&keyMsg3D)); - std::function cloud_cb = boost::bind (&SimpleOpenNIViewer::cloud_callback, this, _1); + std::function cloud_cb = [this] (const CloudConstPtr& cloud) { cloud_callback (cloud); }; boost::signals2::connection cloud_connection = grabber_.registerCallback (cloud_cb); boost::signals2::connection image_connection; @@ -182,7 +182,7 @@ class SimpleOpenNIViewer string keyMsg2D("Key event for image viewer"); image_viewer_.registerMouseCallback (&SimpleOpenNIViewer::mouse_callback, *this, (void*)(&mouseMsg2D)); image_viewer_.registerKeyboardCallback(&SimpleOpenNIViewer::keyboard_callback, *this, (void*)(&keyMsg2D)); - std::function&) > image_cb = boost::bind (&SimpleOpenNIViewer::image_callback, this, _1); + std::function image_cb = [this] (const openni_wrapper::Image::Ptr& img) { image_callback (img); }; image_connection = grabber_.registerCallback (image_cb); } unsigned char* rgb_data = 0; diff --git a/tools/pcd_grabber_viewer.cpp b/tools/pcd_grabber_viewer.cpp index efd9694f473..d0cc6be4b6c 100644 --- a/tools/pcd_grabber_viewer.cpp +++ b/tools/pcd_grabber_viewer.cpp @@ -211,7 +211,10 @@ main (int argc, char** argv) } EventHelper h; - std::function::ConstPtr&) > f = boost::bind (&EventHelper::cloud_cb, &h, _1); + std::function::ConstPtr&)> f = [&] (const pcl::PointCloud::ConstPtr& cloud) + { + h.cloud_cb (cloud); + }; boost::signals2::connection c1 = grabber->registerCallback (f); std::string mouse_msg_3D ("Mouse coordinates in PCL Visualizer"); diff --git a/tools/pcl_video.cpp b/tools/pcl_video.cpp index 10bdc8fedbd..7c84aed0784 100644 --- a/tools/pcl_video.cpp +++ b/tools/pcl_video.cpp @@ -191,8 +191,9 @@ class Recorder // Set up a callback to get clouds from a grabber and write them to the // file. pcl::Grabber* interface(new pcl::OpenNIGrabber()); - std::function::ConstPtr&)> f( - boost::bind(&Recorder::Callback, this, _1)); + std::function::ConstPtr&)> f ( + [this] (const pcl::PointCloud::ConstPtr&) { Callback (cloud); } + ); interface->registerCallback(f); // Start the first cluster cltr_start_ = bpt::microsec_clock::local_time(); diff --git a/tools/real_sense_viewer.cpp b/tools/real_sense_viewer.cpp index e7788ea3bb7..ecf5db7fb2a 100644 --- a/tools/real_sense_viewer.cpp +++ b/tools/real_sense_viewer.cpp @@ -170,7 +170,7 @@ class RealSenseViewer void run () { - std::function f = boost::bind (&RealSenseViewer::cloudCallback, this, _1); + std::function f = [this] (const typename PointCloudT::ConstPtr& cloud) { cloudCallback (cloud); }; connection_ = grabber_.registerCallback (f); grabber_.start (); printMode (grabber_.getMode ()); diff --git a/tools/timed_trigger_test.cpp b/tools/timed_trigger_test.cpp index c703ca07bce..435ae98d937 100644 --- a/tools/timed_trigger_test.cpp +++ b/tools/timed_trigger_test.cpp @@ -39,7 +39,7 @@ int main () global_time = pcl::getTime (); trigger.start (); std::this_thread::sleep_for(2s); - trigger.registerCallback ( boost::bind(&Dummy::myTimer, dummy)); + trigger.registerCallback ([&]{ dummy.myTimer (); }); std::this_thread::sleep_for(3s); trigger.setInterval (0.2); std::this_thread::sleep_for(2s); diff --git a/tools/vlp_viewer.cpp b/tools/vlp_viewer.cpp index a487e31cd80..0a1d89435d5 100644 --- a/tools/vlp_viewer.cpp +++ b/tools/vlp_viewer.cpp @@ -160,8 +160,7 @@ class SimpleVLPViewer cloud_viewer_->setCameraClipDistances (0.0, 50.0); cloud_viewer_->registerKeyboardCallback (&SimpleVLPViewer::keyboard_callback, *this); - std::function cloud_cb = boost::bind (&SimpleVLPViewer::cloud_callback, this, _1); + std::function cloud_cb = [this] (const CloudConstPtr& cloud){ cloud_callback (cloud); }; boost::signals2::connection cloud_connection = grabber_.registerCallback (cloud_cb); grabber_.start ();