28 #ifndef ROSCPP_SUBSCRIPTION_H 29 #define ROSCPP_SUBSCRIPTION_H 32 #include "ros/common.h" 40 #include <boost/thread.hpp> 41 #include <boost/shared_ptr.hpp> 42 #include <boost/enable_shared_from_this.hpp> 50 class SubscriptionCallback;
65 class ROSCPP_DECL
Subscription :
public boost::enable_shared_from_this<Subscription>
83 bool pubUpdate(
const std::vector<std::string> &pubs);
88 bool negotiateConnection(
const std::string& xmlrpc_uri);
99 bool addCallback(
const SubscriptionCallbackHelperPtr& helper,
const std::string& md5sum,
CallbackQueueInterface* queue, int32_t queue_size,
const VoidConstPtr& tracked_object,
bool allow_concurrent_callbacks);
100 void removeCallback(
const SubscriptionCallbackHelperPtr& helper);
102 typedef std::map<std::string, std::string>
M_string;
110 const std::string datatype();
111 const std::string md5sum();
116 void removePublisherLink(
const PublisherLinkPtr& pub_link);
118 const std::string&
getName()
const {
return name_; }
120 uint32_t getNumPublishers();
129 , udp_transport_(udp_transport)
131 , remote_uri_(remote_uri)
161 if (client_->executeCheckDone(result))
163 parent->pendingConnectionDone(boost::dynamic_pointer_cast<PendingConnection>(shared_from_this()), result);
180 void pendingConnectionDone(
const PendingConnectionPtr& pending_conn,
XmlRpc::XmlRpcValue& result);
182 void getPublishTypes(
bool& ser,
bool& nocopy,
const std::type_info& ti);
184 void headerReceived(
const PublisherLinkPtr& link,
const Header& h);
190 void dropAllConnections();
192 void addPublisherLink(
const PublisherLinkPtr& link);
Manages a subscription on a single topic.
const std::string & getRemoteURI()
S_PendingConnection pending_connections_
SubscriptionQueuePtr subscription_queue_
boost::mutex publisher_links_mutex_
Abstract base class used by subscriptions to deal with concrete message types through a common interf...
TransportHints transport_hints_
boost::shared_ptr< SubscriptionCallback > SubscriptionCallbackPtr
boost::shared_ptr< CallbackInfo > CallbackInfoPtr
std::vector< PublisherLinkPtr > V_PublisherLink
void removeSource(XmlRpcSource *source)
M_PublisherLinkToLatchInfo latched_messages_
XmlRpc::XmlRpcClient * getClient() const
const std::string & getName() const
Abstract interface for a queue used to handle all callbacks within roscpp.
V_PublisherLink publisher_links_
boost::mutex pending_connections_mutex_
uint32_t nonconst_callbacks_
virtual void addToDispatch(XmlRpc::XmlRpcDispatch *disp)
boost::shared_ptr< SubscriptionQueue > SubscriptionQueuePtr
boost::shared_ptr< SubscriptionCallbackHelper > SubscriptionCallbackHelperPtr
TransportUDPPtr getUDPTransport() const
Provides a way of specifying network transport hints to ros::NodeHandle::subscribe() and someday ros:...
boost::weak_ptr< Subscription > SubscriptionWPtr
boost::shared_ptr< PublisherLink > PublisherLinkPtr
virtual void removeFromDispatch(XmlRpc::XmlRpcDispatch *disp)
V_TypeAndDeserializer cached_deserializers_
std::map< std::string, std::string > M_string
uint32_t getNumCallbacks() const
SerializedMessage message
boost::weak_ptr< void const > VoidConstWPtr
StatisticsLogger statistics_
boost::mutex callbacks_mutex_
std::set< PendingConnectionPtr > S_PendingConnection
std::vector< CallbackInfoPtr > V_CallbackInfo
VoidConstWPtr tracked_object_
std::map< PublisherLinkPtr, LatchInfo > M_PublisherLinkToLatchInfo
boost::mutex md5sum_mutex_
std::vector< std::pair< const std::type_info *, MessageDeserializerPtr > > V_TypeAndDeserializer
TransportUDPPtr udp_transport_
This class logs statistics data about a ROS connection and publishs them periodically on a common top...
CallbackQueueInterface * callback_queue_
SubscriptionCallbackHelperPtr helper_
bool isDropped()
Returns whether this Subscription has been dropped or not.
void addSource(XmlRpcSource *source, unsigned eventMask)
XmlRpc::XmlRpcClient * client_
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
boost::mutex shutdown_mutex_
boost::shared_ptr< MessageDeserializer > MessageDeserializerPtr
boost::shared_ptr< PendingConnection > PendingConnectionPtr
V_CallbackInfo callbacks_
boost::shared_ptr< std::map< std::string, std::string > > connection_header
PendingConnection(XmlRpc::XmlRpcClient *client, TransportUDPPtr udp_transport, const SubscriptionWPtr &parent, const std::string &remote_uri)