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

◆ CallbackInfoPtr

Definition at line 204 of file subscription.h.

◆ M_PublisherLinkToLatchInfo

Definition at line 239 of file subscription.h.

◆ M_string

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

Definition at line 102 of file subscription.h.

◆ PendingConnectionPtr

Definition at line 178 of file subscription.h.

◆ S_PendingConnection

Definition at line 219 of file subscription.h.

◆ V_CallbackInfo

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

Definition at line 205 of file subscription.h.

◆ V_PublisherLink

Definition at line 223 of file subscription.h.

◆ V_TypeAndDeserializer

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

◆ Subscription() [1/2]

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.

◆ ~Subscription()

ros::Subscription::~Subscription ( )
virtual

Definition at line 80 of file subscription.cpp.

◆ Subscription() [2/2]

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

Member Function Documentation

◆ addCallback()

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 692 of file subscription.cpp.

◆ addLocalConnection()

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

Definition at line 189 of file subscription.cpp.

◆ addPublisherLink()

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

Definition at line 809 of file subscription.cpp.

◆ datatype()

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

Definition at line 853 of file subscription.cpp.

◆ drop()

void ros::Subscription::drop ( )

Terminate all our PublisherLinks.

Definition at line 159 of file subscription.cpp.

◆ dropAllConnections()

void ros::Subscription::dropAllConnections ( )
private

Definition at line 169 of file subscription.cpp.

◆ getInfo()

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

Definition at line 123 of file subscription.cpp.

◆ getName()

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

Definition at line 118 of file subscription.h.

◆ getNumCallbacks()

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

Definition at line 119 of file subscription.h.

◆ getNumPublishers()

uint32_t ros::Subscription::getNumPublishers ( )

Definition at line 142 of file subscription.cpp.

◆ getPublishTypes()

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

Definition at line 830 of file subscription.cpp.

◆ getStats()

XmlRpcValue ros::Subscription::getStats ( )

Definition at line 96 of file subscription.cpp.

◆ handleMessage()

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 610 of file subscription.cpp.

◆ headerReceived()

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

Definition at line 799 of file subscription.cpp.

◆ isDropped()

bool ros::Subscription::isDropped ( )
inline

Returns whether this Subscription has been dropped or not.

Definition at line 95 of file subscription.h.

◆ md5sum()

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

Definition at line 858 of file subscription.cpp.

◆ negotiateConnection()

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 353 of file subscription.cpp.

◆ operator=()

Subscription& ros::Subscription::operator= ( const Subscription )
private

◆ pendingConnectionDone()

void ros::Subscription::pendingConnectionDone ( const PendingConnectionPtr pending_conn,
XmlRpc::XmlRpcValue result 
)

Definition at line 456 of file subscription.cpp.

◆ pubUpdate()

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 217 of file subscription.cpp.

◆ removeCallback()

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

Definition at line 769 of file subscription.cpp.

◆ removePublisherLink()

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

Removes a subscriber from our list.

Definition at line 814 of file subscription.cpp.

◆ shutdown()

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

◆ cached_deserializers_

V_TypeAndDeserializer ros::Subscription::cached_deserializers_
private

Definition at line 243 of file subscription.h.

◆ callbacks_

V_CallbackInfo ros::Subscription::callbacks_
private

Definition at line 212 of file subscription.h.

◆ callbacks_mutex_

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

Definition at line 211 of file subscription.h.

◆ datatype_

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

Definition at line 210 of file subscription.h.

◆ dropped_

bool ros::Subscription::dropped_
private

Definition at line 215 of file subscription.h.

◆ latched_messages_

M_PublisherLinkToLatchInfo ros::Subscription::latched_messages_
private

Definition at line 240 of file subscription.h.

◆ md5sum_

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

Definition at line 209 of file subscription.h.

◆ md5sum_mutex_

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

Definition at line 208 of file subscription.h.

◆ name_

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

Definition at line 207 of file subscription.h.

◆ nonconst_callbacks_

uint32_t ros::Subscription::nonconst_callbacks_
private

Definition at line 213 of file subscription.h.

◆ pending_connections_

S_PendingConnection ros::Subscription::pending_connections_
private

Definition at line 220 of file subscription.h.

◆ pending_connections_mutex_

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

Definition at line 221 of file subscription.h.

◆ publisher_links_

V_PublisherLink ros::Subscription::publisher_links_
private

Definition at line 224 of file subscription.h.

◆ publisher_links_mutex_

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

Definition at line 225 of file subscription.h.

◆ shutdown_mutex_

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

Definition at line 217 of file subscription.h.

◆ shutting_down_

bool ros::Subscription::shutting_down_
private

Definition at line 216 of file subscription.h.

◆ statistics_

StatisticsLogger ros::Subscription::statistics_
private

Definition at line 229 of file subscription.h.

◆ transport_hints_

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 , Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:36