Manages a subscription on a single topic. More...
#include <subscription.h>
Classes | |
struct | CallbackInfo |
struct | LatchInfo |
class | PendingConnection |
Public Types | |
typedef std::map< std::string, std::string > | M_string |
typedef boost::shared_ptr < PendingConnection > | PendingConnectionPtr |
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. | |
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. | |
void | headerReceived (const PublisherLinkPtr &link, const Header &h) |
bool | isDropped () |
Returns whether this Subscription has been dropped or not. | |
const std::string | md5sum () |
bool | negotiateConnection (const std::string &xmlrpc_uri) |
Negotiates a connection with a publisher. | |
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. | |
void | removeCallback (const SubscriptionCallbackHelperPtr &helper) |
void | removePublisherLink (const PublisherLinkPtr &pub_link) |
Removes a subscriber from our list. | |
void | shutdown () |
Terminate all our PublisherLinks and join our callback thread if it exists. | |
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 < CallbackInfo > | CallbackInfoPtr |
typedef std::map < PublisherLinkPtr, LatchInfo > | M_PublisherLinkToLatchInfo |
typedef std::set < PendingConnectionPtr > | S_PendingConnection |
typedef std::vector < CallbackInfoPtr > | V_CallbackInfo |
typedef std::vector < PublisherLinkPtr > | V_PublisherLink |
typedef std::vector< std::pair < const std::type_info *, MessageDeserializerPtr > > | V_TypeAndDeserializer |
Private Member Functions | |
void | addPublisherLink (const PublisherLinkPtr &link) |
void | dropAllConnections () |
Subscription & | operator= (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_ |
TransportHints | transport_hints_ |
Manages a subscription on a single topic.
Definition at line 64 of file subscription.h.
typedef boost::shared_ptr<CallbackInfo> ros::Subscription::CallbackInfoPtr [private] |
Definition at line 203 of file subscription.h.
typedef std::map<PublisherLinkPtr, LatchInfo> ros::Subscription::M_PublisherLinkToLatchInfo [private] |
Definition at line 236 of file subscription.h.
typedef std::map<std::string, std::string> ros::Subscription::M_string |
Definition at line 101 of file subscription.h.
typedef boost::shared_ptr<PendingConnection> ros::Subscription::PendingConnectionPtr |
Definition at line 177 of file subscription.h.
typedef std::set<PendingConnectionPtr> ros::Subscription::S_PendingConnection [private] |
Definition at line 218 of file subscription.h.
typedef std::vector<CallbackInfoPtr> ros::Subscription::V_CallbackInfo [private] |
Definition at line 204 of file subscription.h.
typedef std::vector<PublisherLinkPtr> ros::Subscription::V_PublisherLink [private] |
Definition at line 222 of file subscription.h.
typedef std::vector<std::pair<const std::type_info*, MessageDeserializerPtr> > ros::Subscription::V_TypeAndDeserializer [private] |
Definition at line 239 of file subscription.h.
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] |
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 676 of file subscription.cpp.
void ros::Subscription::addLocalConnection | ( | const PublicationPtr & | pub | ) |
Definition at line 179 of file subscription.cpp.
void ros::Subscription::addPublisherLink | ( | const PublisherLinkPtr & | link | ) | [private] |
Definition at line 790 of file subscription.cpp.
const std::string ros::Subscription::datatype | ( | ) |
Definition at line 834 of file subscription.cpp.
void ros::Subscription::drop | ( | ) |
Terminate all our PublisherLinks.
Definition at line 149 of file subscription.cpp.
void ros::Subscription::dropAllConnections | ( | ) | [private] |
Definition at line 159 of file subscription.cpp.
void ros::Subscription::getInfo | ( | XmlRpc::XmlRpcValue & | info | ) |
Definition at line 126 of file subscription.cpp.
const std::string& ros::Subscription::getName | ( | ) | const [inline] |
Definition at line 117 of file subscription.h.
uint32_t ros::Subscription::getNumCallbacks | ( | ) | const [inline] |
Definition at line 118 of file subscription.h.
uint32_t ros::Subscription::getNumPublishers | ( | ) |
Definition at line 143 of file subscription.cpp.
void ros::Subscription::getPublishTypes | ( | bool & | ser, |
bool & | nocopy, | ||
const std::type_info & | ti | ||
) |
Definition at line 811 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 597 of file subscription.cpp.
void ros::Subscription::headerReceived | ( | const PublisherLinkPtr & | link, |
const Header & | h | ||
) |
Definition at line 781 of file subscription.cpp.
bool ros::Subscription::isDropped | ( | ) | [inline] |
Returns whether this Subscription has been dropped or not.
Definition at line 94 of file subscription.h.
const std::string ros::Subscription::md5sum | ( | ) |
Definition at line 839 of file subscription.cpp.
bool ros::Subscription::negotiateConnection | ( | const std::string & | xmlrpc_uri | ) |
Negotiates a connection with a publisher.
xmlrpc_uri | The XMLRPC URI to connect to to negotiate the connection |
Definition at line 340 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 443 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 207 of file subscription.cpp.
void ros::Subscription::removeCallback | ( | const SubscriptionCallbackHelperPtr & | helper | ) |
Definition at line 751 of file subscription.cpp.
void ros::Subscription::removePublisherLink | ( | const PublisherLinkPtr & | pub_link | ) |
Removes a subscriber from our list.
Definition at line 795 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.
Definition at line 240 of file subscription.h.
V_CallbackInfo ros::Subscription::callbacks_ [private] |
Definition at line 211 of file subscription.h.
boost::mutex ros::Subscription::callbacks_mutex_ [private] |
Definition at line 210 of file subscription.h.
std::string ros::Subscription::datatype_ [private] |
Definition at line 209 of file subscription.h.
bool ros::Subscription::dropped_ [private] |
Definition at line 214 of file subscription.h.
Definition at line 237 of file subscription.h.
std::string ros::Subscription::md5sum_ [private] |
Definition at line 208 of file subscription.h.
boost::mutex ros::Subscription::md5sum_mutex_ [private] |
Definition at line 207 of file subscription.h.
std::string ros::Subscription::name_ [private] |
Definition at line 206 of file subscription.h.
uint32_t ros::Subscription::nonconst_callbacks_ [private] |
Definition at line 212 of file subscription.h.
Definition at line 219 of file subscription.h.
boost::mutex ros::Subscription::pending_connections_mutex_ [private] |
Definition at line 220 of file subscription.h.
Definition at line 223 of file subscription.h.
boost::mutex ros::Subscription::publisher_links_mutex_ [private] |
Definition at line 224 of file subscription.h.
boost::mutex ros::Subscription::shutdown_mutex_ [private] |
Definition at line 216 of file subscription.h.
bool ros::Subscription::shutting_down_ [private] |
Definition at line 215 of file subscription.h.
Definition at line 226 of file subscription.h.