diff --git a/io/include/pcl/io/grabber.h b/io/include/pcl/io/grabber.h index 596b2b0648e..814885b4bcf 100644 --- a/io/include/pcl/io/grabber.h +++ b/io/include/pcl/io/grabber.h @@ -57,12 +57,8 @@ namespace pcl class PCL_EXPORTS Grabber { public: - - /** \brief Constructor. */ - Grabber () {} - /** \brief virtual destructor. */ - virtual inline ~Grabber () throw (); + virtual inline ~Grabber () noexcept; /** \brief registers a callback function/method to a signal with the corresponding signature * \param[in] callback: the callback function/method @@ -101,6 +97,13 @@ namespace pcl virtual void stop () = 0; + /** \brief For devices that are streaming, stopped streams are started and running stream are stopped. + * For triggered devices, the behavior is not defined. + * \return true if grabber is running / streaming. False otherwise. + */ + inline bool + toggle (); + /** \brief returns the name of the concrete subclass. * \return the name of the concrete driver. */ @@ -151,12 +154,25 @@ namespace pcl std::map > shared_connections_; } ; - Grabber::~Grabber () throw () + Grabber::~Grabber () noexcept { for (auto &signal : signals_) delete signal.second; } + bool + Grabber::toggle () + { + if (isRunning ()) + { + stop (); + } else + { + start (); + } + return isRunning (); + } + template boost::signals2::signal* Grabber::find_signal () const {