Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ros::Subscription Class Reference

Manages a subscription on a single topic. More...

#include <subscription.h>

Inheritance diagram for ros::Subscription:
Inheritance graph
[legend]

Classes

struct  CallbackInfo
 
struct  LatchInfo
 
class  PendingConnection
 

Public Types

typedef std::map< std::string, std::string > M_string
 
typedef boost::shared_ptr< PendingConnectionPendingConnectionPtr
 

Public Member Functions

bool addCallback (const SubscriptionCallbackHelperPtr &helper, const std::string &md5sum, CallbackQueueInterface *queue, int32_t queue_size, const VoidConstPtr &tracked_object, bool allow_concurrent_callbacks)
 
void addLocalConnection (const PublicationPtr &pub)
 
const std::string datatype ()
 
void drop ()
 Terminate all our PublisherLinks. More...
 
void getInfo (XmlRpc::XmlRpcValue &info)
 
const std::string & getName () const
 
uint32_t getNumCallbacks () const
 
uint32_t getNumPublishers ()
 
void getPublishTypes (bool &ser, bool &nocopy, const std::type_info &ti)
 
XmlRpc::XmlRpcValue getStats ()
 
uint32_t handleMessage (const SerializedMessage &m, bool ser, bool nocopy, const boost::shared_ptr< M_string > &connection_header, const PublisherLinkPtr &link)
 Called to notify that a new message has arrived from a publisher. Schedules the callback for invokation with the callback queue. More...
 
void headerReceived (const PublisherLinkPtr &link, const Header &h)
 
bool isDropped ()
 Returns whether this Subscription has been dropped or not. More...
 
const std::string md5sum ()
 
bool negotiateConnection (const std::string &xmlrpc_uri)
 Negotiates a connection with a publisher. More...
 
void pendingConnectionDone (const PendingConnectionPtr &pending_conn, XmlRpc::XmlRpcValue &result)
 
bool pubUpdate (const std::vector< std::string > &pubs)
 Handle a publisher update list received from the master. Creates/drops PublisherLinks based on the list. Never handles new self-subscriptions. More...
 
void removeCallback (const SubscriptionCallbackHelperPtr &helper)
 
void removePublisherLink (const PublisherLinkPtr &pub_link)
 Removes a subscriber from our list. More...
 
void shutdown ()
 Terminate all our PublisherLinks and join our callback thread if it exists. More...
 
 Subscription (const std::string &name, const std::string &md5sum, const std::string &datatype, const TransportHints &transport_hints)
 
virtual ~Subscription ()
 

Private Types

typedef boost::shared_ptr< CallbackInfoCallbackInfoPtr
 
typedef std::map< PublisherLinkPtr, LatchInfoM_PublisherLinkToLatchInfo
 
typedef std::set< PendingConnectionPtrS_PendingConnection
 
typedef std::vector< CallbackInfoPtrV_CallbackInfo
 
typedef std::vector< PublisherLinkPtrV_PublisherLink
 
typedef std::vector< std::pair< const std::type_info *, MessageDeserializerPtr > > V_TypeAndDeserializer
 

Private Member Functions

void addPublisherLink (const PublisherLinkPtr &link)
 
void dropAllConnections ()
 
Subscriptionoperator= (const Subscription &)
 
 Subscription (const Subscription &)
 

Private Attributes

V_TypeAndDeserializer cached_deserializers_
 
V_CallbackInfo callbacks_
 
boost::mutex callbacks_mutex_
 
std::string datatype_
 
bool dropped_
 
M_PublisherLinkToLatchInfo latched_messages_
 
std::string md5sum_
 
boost::mutex md5sum_mutex_
 
std::string name_
 
uint32_t nonconst_callbacks_
 
S_PendingConnection pending_connections_
 
boost::mutex pending_connections_mutex_
 
V_PublisherLink publisher_links_
 
boost::mutex publisher_links_mutex_
 
boost::mutex shutdown_mutex_
 
bool shutting_down_
 
StatisticsLogger statistics_
 
TransportHints transport_hints_
 

Detailed Description

Manages a subscription on a single topic.

Definition at line 65 of file subscription.h.

Member Typedef Documentation

Definition at line 204 of file subscription.h.

Definition at line 239 of file subscription.h.

typedef std::map<std::string, std::string> ros::Subscription::M_string

Definition at line 102 of file subscription.h.

Definition at line 178 of file subscription.h.

Definition at line 219 of file subscription.h.

typedef std::vector<CallbackInfoPtr> ros::Subscription::V_CallbackInfo
private

Definition at line 205 of file subscription.h.

Definition at line 223 of file subscription.h.

typedef std::vector<std::pair<const std::type_info*, MessageDeserializerPtr> > ros::Subscription::V_TypeAndDeserializer
private

Definition at line 242 of file subscription.h.

Constructor & Destructor Documentation

ros::Subscription::Subscription ( const std::string &  name,
const std::string &  md5sum,
const std::string &  datatype,
const TransportHints transport_hints 
)

Definition at line 69 of file subscription.cpp.

ros::Subscription::~Subscription ( )
virtual

Definition at line 80 of file subscription.cpp.

ros::Subscription::Subscription ( const Subscription )
private

Member Function Documentation

bool ros::Subscription::addCallback ( const SubscriptionCallbackHelperPtr helper,
const std::string &  md5sum,
CallbackQueueInterface queue,
int32_t  queue_size,
const VoidConstPtr tracked_object,
bool  allow_concurrent_callbacks 
)

Definition at line 681 of file subscription.cpp.

void ros::Subscription::addLocalConnection ( const PublicationPtr pub)

Definition at line 178 of file subscription.cpp.

void ros::Subscription::addPublisherLink ( const PublisherLinkPtr link)
private

Definition at line 798 of file subscription.cpp.

const std::string ros::Subscription::datatype ( )

Definition at line 842 of file subscription.cpp.

void ros::Subscription::drop ( )

Terminate all our PublisherLinks.

Definition at line 148 of file subscription.cpp.

void ros::Subscription::dropAllConnections ( )
private

Definition at line 158 of file subscription.cpp.

void ros::Subscription::getInfo ( XmlRpc::XmlRpcValue info)

Definition at line 123 of file subscription.cpp.

const std::string& ros::Subscription::getName ( ) const
inline

Definition at line 118 of file subscription.h.

uint32_t ros::Subscription::getNumCallbacks ( ) const
inline

Definition at line 119 of file subscription.h.

uint32_t ros::Subscription::getNumPublishers ( )

Definition at line 142 of file subscription.cpp.

void ros::Subscription::getPublishTypes ( bool &  ser,
bool &  nocopy,
const std::type_info &  ti 
)

Definition at line 819 of file subscription.cpp.

XmlRpcValue ros::Subscription::getStats ( )

Definition at line 96 of file subscription.cpp.

uint32_t ros::Subscription::handleMessage ( const SerializedMessage m,
bool  ser,
bool  nocopy,
const boost::shared_ptr< M_string > &  connection_header,
const PublisherLinkPtr link 
)

Called to notify that a new message has arrived from a publisher. Schedules the callback for invokation with the callback queue.

Definition at line 599 of file subscription.cpp.

void ros::Subscription::headerReceived ( const PublisherLinkPtr link,
const Header h 
)

Definition at line 788 of file subscription.cpp.

bool ros::Subscription::isDropped ( )
inline

Returns whether this Subscription has been dropped or not.

Definition at line 95 of file subscription.h.

const std::string ros::Subscription::md5sum ( )

Definition at line 847 of file subscription.cpp.

bool ros::Subscription::negotiateConnection ( const std::string &  xmlrpc_uri)

Negotiates a connection with a publisher.

Parameters
xmlrpc_uriThe XMLRPC URI to connect to to negotiate the connection

Definition at line 342 of file subscription.cpp.

Subscription& ros::Subscription::operator= ( const Subscription )
private
void ros::Subscription::pendingConnectionDone ( const PendingConnectionPtr pending_conn,
XmlRpc::XmlRpcValue result 
)

Definition at line 445 of file subscription.cpp.

bool ros::Subscription::pubUpdate ( const std::vector< std::string > &  pubs)

Handle a publisher update list received from the master. Creates/drops PublisherLinks based on the list. Never handles new self-subscriptions.

Definition at line 206 of file subscription.cpp.

void ros::Subscription::removeCallback ( const SubscriptionCallbackHelperPtr helper)

Definition at line 758 of file subscription.cpp.

void ros::Subscription::removePublisherLink ( const PublisherLinkPtr pub_link)

Removes a subscriber from our list.

Definition at line 803 of file subscription.cpp.

void ros::Subscription::shutdown ( )

Terminate all our PublisherLinks and join our callback thread if it exists.

Definition at line 86 of file subscription.cpp.

Member Data Documentation

V_TypeAndDeserializer ros::Subscription::cached_deserializers_
private

Definition at line 243 of file subscription.h.

V_CallbackInfo ros::Subscription::callbacks_
private

Definition at line 212 of file subscription.h.

boost::mutex ros::Subscription::callbacks_mutex_
private

Definition at line 211 of file subscription.h.

std::string ros::Subscription::datatype_
private

Definition at line 210 of file subscription.h.

bool ros::Subscription::dropped_
private

Definition at line 215 of file subscription.h.

M_PublisherLinkToLatchInfo ros::Subscription::latched_messages_
private

Definition at line 240 of file subscription.h.

std::string ros::Subscription::md5sum_
private

Definition at line 209 of file subscription.h.

boost::mutex ros::Subscription::md5sum_mutex_
private

Definition at line 208 of file subscription.h.

std::string ros::Subscription::name_
private

Definition at line 207 of file subscription.h.

uint32_t ros::Subscription::nonconst_callbacks_
private

Definition at line 213 of file subscription.h.

S_PendingConnection ros::Subscription::pending_connections_
private

Definition at line 220 of file subscription.h.

boost::mutex ros::Subscription::pending_connections_mutex_
private

Definition at line 221 of file subscription.h.

V_PublisherLink ros::Subscription::publisher_links_
private

Definition at line 224 of file subscription.h.

boost::mutex ros::Subscription::publisher_links_mutex_
private

Definition at line 225 of file subscription.h.

boost::mutex ros::Subscription::shutdown_mutex_
private

Definition at line 217 of file subscription.h.

bool ros::Subscription::shutting_down_
private

Definition at line 216 of file subscription.h.

StatisticsLogger ros::Subscription::statistics_
private

Definition at line 229 of file subscription.h.

TransportHints ros::Subscription::transport_hints_
private

Definition at line 227 of file subscription.h.


The documentation for this class was generated from the following files:


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
autogenerated on Mon Nov 2 2020 03:52:27