From 231a457bb7f3d19ca2e5eb3d3e7b0b0f73babea3 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Fri, 28 Mar 2014 16:01:55 -0700 Subject: [PATCH 1/2] update API to use boost::signals2 (#267) --- clients/roscpp/include/ros/connection.h | 16 ++++------------ clients/roscpp/include/ros/connection_manager.h | 4 ++-- clients/roscpp/include/ros/poll_manager.h | 16 ++++------------ clients/roscpp/include/ros/service_client_link.h | 4 ++-- .../include/ros/transport_subscriber_link.h | 4 ++-- clients/roscpp/src/libros/connection.cpp | 4 ++-- clients/roscpp/src/libros/poll_manager.cpp | 4 ++-- .../include/message_filters/cache.h | 10 +--------- .../include/message_filters/connection.h | 8 ++++---- .../include/message_filters/subscriber.h | 10 +--------- .../sync_policies/approximate_time.h | 10 +--------- .../message_filters/sync_policies/exact_time.h | 10 +--------- .../include/message_filters/synchronizer.h | 10 +--------- utilities/message_filters/src/connection.cpp | 2 +- 14 files changed, 28 insertions(+), 84 deletions(-) diff --git a/clients/roscpp/include/ros/connection.h b/clients/roscpp/include/ros/connection.h index d5916057bb..fbef78cb22 100644 --- a/clients/roscpp/include/ros/connection.h +++ b/clients/roscpp/include/ros/connection.h @@ -38,15 +38,7 @@ #include "ros/header.h" #include "common.h" -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include #include @@ -152,13 +144,13 @@ class ROSCPP_DECL Connection : public boost::enable_shared_from_this */ void write(const boost::shared_array& buffer, uint32_t size, const WriteFinishedFunc& finished_callback, bool immedate = true); - typedef boost::signal DropSignal; + typedef boost::signals2::signal DropSignal; typedef boost::function DropFunc; /** * \brief Add a callback to be called when this connection has dropped */ - boost::signals::connection addDropListener(const DropFunc& slot); - void removeDropListener(const boost::signals::connection& c); + boost::signals2::connection addDropListener(const DropFunc& slot); + void removeDropListener(const boost::signals2::connection& c); /** * \brief Set the header receipt callback diff --git a/clients/roscpp/include/ros/connection_manager.h b/clients/roscpp/include/ros/connection_manager.h index 90ee781198..3778a8c69d 100644 --- a/clients/roscpp/include/ros/connection_manager.h +++ b/clients/roscpp/include/ros/connection_manager.h @@ -30,7 +30,7 @@ #include "common.h" #include -#include +#include namespace ros { @@ -94,7 +94,7 @@ class ROSCPP_DECL ConnectionManager uint32_t connection_id_counter_; boost::mutex connection_id_counter_mutex_; - boost::signals::connection poll_conn_; + boost::signals2::connection poll_conn_; TransportTCPPtr tcpserver_transport_; TransportUDPPtr udpserver_transport_; diff --git a/clients/roscpp/include/ros/poll_manager.h b/clients/roscpp/include/ros/poll_manager.h index 4762382fe5..86b1b60dea 100644 --- a/clients/roscpp/include/ros/poll_manager.h +++ b/clients/roscpp/include/ros/poll_manager.h @@ -32,15 +32,7 @@ #include "poll_set.h" #include "common.h" -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include #include @@ -50,7 +42,7 @@ namespace ros class PollManager; typedef boost::shared_ptr PollManagerPtr; -typedef boost::signal VoidSignal; +typedef boost::signals2::signal VoidSignal; typedef boost::function VoidFunc; class ROSCPP_DECL PollManager @@ -63,8 +55,8 @@ class ROSCPP_DECL PollManager PollSet& getPollSet() { return poll_set_; } - boost::signals::connection addPollThreadListener(const VoidFunc& func); - void removePollThreadListener(boost::signals::connection c); + boost::signals2::connection addPollThreadListener(const VoidFunc& func); + void removePollThreadListener(boost::signals2::connection c); void start(); void shutdown(); diff --git a/clients/roscpp/include/ros/service_client_link.h b/clients/roscpp/include/ros/service_client_link.h index 413e8b0312..370e8bd793 100644 --- a/clients/roscpp/include/ros/service_client_link.h +++ b/clients/roscpp/include/ros/service_client_link.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include @@ -79,7 +79,7 @@ class ROSCPP_DECL ServiceClientLink : public boost::enable_shared_from_this ServiceClientLinkPtr; diff --git a/clients/roscpp/include/ros/transport_subscriber_link.h b/clients/roscpp/include/ros/transport_subscriber_link.h index cf1d19e73f..67e7662a6d 100644 --- a/clients/roscpp/include/ros/transport_subscriber_link.h +++ b/clients/roscpp/include/ros/transport_subscriber_link.h @@ -30,7 +30,7 @@ #include "common.h" #include "subscriber_link.h" -#include +#include namespace ros { @@ -66,7 +66,7 @@ class ROSCPP_DECL TransportSubscriberLink : public SubscriberLink bool header_written_; ConnectionPtr connection_; - boost::signals::connection dropped_conn_; + boost::signals2::connection dropped_conn_; std::queue outbox_; boost::mutex outbox_mutex_; diff --git a/clients/roscpp/src/libros/connection.cpp b/clients/roscpp/src/libros/connection.cpp index 93d164aff1..e0a41b66e3 100644 --- a/clients/roscpp/src/libros/connection.cpp +++ b/clients/roscpp/src/libros/connection.cpp @@ -84,13 +84,13 @@ void Connection::initialize(const TransportPtr& transport, bool is_server, const } } -boost::signals::connection Connection::addDropListener(const DropFunc& slot) +boost::signals2::connection Connection::addDropListener(const DropFunc& slot) { boost::recursive_mutex::scoped_lock lock(drop_mutex_); return drop_signal_.connect(slot); } -void Connection::removeDropListener(const boost::signals::connection& c) +void Connection::removeDropListener(const boost::signals2::connection& c) { boost::recursive_mutex::scoped_lock lock(drop_mutex_); c.disconnect(); diff --git a/clients/roscpp/src/libros/poll_manager.cpp b/clients/roscpp/src/libros/poll_manager.cpp index 95ac978fa8..06ec8cfab7 100644 --- a/clients/roscpp/src/libros/poll_manager.cpp +++ b/clients/roscpp/src/libros/poll_manager.cpp @@ -98,13 +98,13 @@ void PollManager::threadFunc() } } -boost::signals::connection PollManager::addPollThreadListener(const VoidFunc& func) +boost::signals2::connection PollManager::addPollThreadListener(const VoidFunc& func) { boost::recursive_mutex::scoped_lock lock(signal_mutex_); return poll_signal_.connect(func); } -void PollManager::removePollThreadListener(boost::signals::connection c) +void PollManager::removePollThreadListener(boost::signals2::connection c) { boost::recursive_mutex::scoped_lock lock(signal_mutex_); c.disconnect(); diff --git a/utilities/message_filters/include/message_filters/cache.h b/utilities/message_filters/include/message_filters/cache.h index e4b4cee73f..cbe01bc763 100644 --- a/utilities/message_filters/include/message_filters/cache.h +++ b/utilities/message_filters/include/message_filters/cache.h @@ -39,15 +39,7 @@ #include "boost/thread.hpp" #include "boost/shared_ptr.hpp" -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include "ros/time.h" diff --git a/utilities/message_filters/include/message_filters/connection.h b/utilities/message_filters/include/message_filters/connection.h index 2c387995c4..8b840f5241 100644 --- a/utilities/message_filters/include/message_filters/connection.h +++ b/utilities/message_filters/include/message_filters/connection.h @@ -36,7 +36,7 @@ #define MESSAGE_FILTERS_CONNECTION_H #include -#include +#include #include "macros.h" namespace message_filters @@ -52,19 +52,19 @@ class MESSAGE_FILTERS_DECL Connection typedef boost::function WithConnectionDisconnectFunction; Connection() {} Connection(const VoidDisconnectFunction& func); - Connection(const WithConnectionDisconnectFunction& func, boost::signals::connection conn); + Connection(const WithConnectionDisconnectFunction& func, boost::signals2::connection conn); /** * \brief disconnects this connection */ void disconnect(); - boost::signals::connection getBoostConnection() const { return connection_; } + boost::signals2::connection getBoostConnection() const { return connection_; } private: VoidDisconnectFunction void_disconnect_; WithConnectionDisconnectFunction connection_disconnect_; - boost::signals::connection connection_; + boost::signals2::connection connection_; }; } diff --git a/utilities/message_filters/include/message_filters/subscriber.h b/utilities/message_filters/include/message_filters/subscriber.h index 06c6264c78..6109b6398d 100644 --- a/utilities/message_filters/include/message_filters/subscriber.h +++ b/utilities/message_filters/include/message_filters/subscriber.h @@ -37,15 +37,7 @@ #include -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include diff --git a/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h b/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h index 31ff4bdcea..7c3739b91c 100644 --- a/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h +++ b/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h @@ -45,15 +45,7 @@ #include #include -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include #include diff --git a/utilities/message_filters/include/message_filters/sync_policies/exact_time.h b/utilities/message_filters/include/message_filters/sync_policies/exact_time.h index 479228087b..8c28972993 100644 --- a/utilities/message_filters/include/message_filters/sync_policies/exact_time.h +++ b/utilities/message_filters/include/message_filters/sync_policies/exact_time.h @@ -45,15 +45,7 @@ #include #include -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include #include diff --git a/utilities/message_filters/include/message_filters/synchronizer.h b/utilities/message_filters/include/message_filters/synchronizer.h index de17cf4bc3..986b4b7825 100644 --- a/utilities/message_filters/include/message_filters/synchronizer.h +++ b/utilities/message_filters/include/message_filters/synchronizer.h @@ -40,15 +40,7 @@ #include #include -#ifndef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define BOOST_SIGNALS_NO_DEPRECATION_WARNING -#define ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif -#include -#ifdef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef ros_BOOST_SIGNALS_NO_DEPRECATION_WARNING -#undef BOOST_SIGNALS_NO_DEPRECATION_WARNING -#endif +#include #include #include diff --git a/utilities/message_filters/src/connection.cpp b/utilities/message_filters/src/connection.cpp index 71470802b0..d2f0292c0c 100644 --- a/utilities/message_filters/src/connection.cpp +++ b/utilities/message_filters/src/connection.cpp @@ -43,7 +43,7 @@ Connection::Connection(const VoidDisconnectFunction& func) { } -Connection::Connection(const WithConnectionDisconnectFunction& func, boost::signals::connection c) +Connection::Connection(const WithConnectionDisconnectFunction& func, boost::signals2::connection c) : connection_disconnect_(func) , connection_(c) { From c82fb18cb521a71d5c0095e521eacd46bd9d6395 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Mon, 31 Mar 2014 10:50:07 -0700 Subject: [PATCH 2/2] remove unnecessary boost signals includes --- utilities/message_filters/include/message_filters/cache.h | 2 -- utilities/message_filters/include/message_filters/subscriber.h | 2 -- .../include/message_filters/sync_policies/approximate_time.h | 2 -- .../include/message_filters/sync_policies/exact_time.h | 2 -- .../message_filters/include/message_filters/synchronizer.h | 2 -- 5 files changed, 10 deletions(-) diff --git a/utilities/message_filters/include/message_filters/cache.h b/utilities/message_filters/include/message_filters/cache.h index cbe01bc763..b4f935cf46 100644 --- a/utilities/message_filters/include/message_filters/cache.h +++ b/utilities/message_filters/include/message_filters/cache.h @@ -39,8 +39,6 @@ #include "boost/thread.hpp" #include "boost/shared_ptr.hpp" -#include - #include "ros/time.h" #include "connection.h" diff --git a/utilities/message_filters/include/message_filters/subscriber.h b/utilities/message_filters/include/message_filters/subscriber.h index 6109b6398d..901551497a 100644 --- a/utilities/message_filters/include/message_filters/subscriber.h +++ b/utilities/message_filters/include/message_filters/subscriber.h @@ -37,8 +37,6 @@ #include -#include - #include #include "connection.h" diff --git a/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h b/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h index 7c3739b91c..a03dfc869a 100644 --- a/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h +++ b/utilities/message_filters/include/message_filters/sync_policies/approximate_time.h @@ -45,8 +45,6 @@ #include #include -#include - #include #include #include diff --git a/utilities/message_filters/include/message_filters/sync_policies/exact_time.h b/utilities/message_filters/include/message_filters/sync_policies/exact_time.h index 8c28972993..306f786619 100644 --- a/utilities/message_filters/include/message_filters/sync_policies/exact_time.h +++ b/utilities/message_filters/include/message_filters/sync_policies/exact_time.h @@ -45,8 +45,6 @@ #include #include -#include - #include #include #include diff --git a/utilities/message_filters/include/message_filters/synchronizer.h b/utilities/message_filters/include/message_filters/synchronizer.h index 986b4b7825..7891890ebf 100644 --- a/utilities/message_filters/include/message_filters/synchronizer.h +++ b/utilities/message_filters/include/message_filters/synchronizer.h @@ -40,8 +40,6 @@ #include #include -#include - #include #include #include