Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ros::TopicManager Class Reference

#include <topic_manager.h>

Public Member Functions

bool advertise (const AdvertiseOptions &ops, const SubscriberCallbacksPtr &callbacks)
 
void getAdvertisedTopics (V_string &topics)
 Get the list of topics advertised by this node. More...
 
size_t getNumPublishers (const std::string &_topic)
 Return the number of publishers connected to this node on a particular topic. More...
 
size_t getNumSubscribers (const std::string &_topic)
 Return the number of subscribers a node has for a particular topic: More...
 
size_t getNumSubscriptions ()
 
void getSubscribedTopics (V_string &topics)
 Get the list of topics subscribed to by this node. More...
 
void incrementSequence (const std::string &_topic)
 
bool isLatched (const std::string &topic)
 
PublicationPtr lookupPublication (const std::string &topic)
 Lookup an advertised topic. More...
 
template<typename M >
void publish (const std::string &topic, const M &message)
 
void publish (const std::string &_topic, const boost::function< SerializedMessage(void)> &serfunc, SerializedMessage &m)
 
void shutdown ()
 
void start ()
 
bool subscribe (const SubscribeOptions &ops)
 
 TopicManager ()
 
bool unadvertise (const std::string &topic, const SubscriberCallbacksPtr &callbacks)
 
bool unsubscribe (const std::string &_topic, const SubscriptionCallbackHelperPtr &helper)
 
 ~TopicManager ()
 

Static Public Member Functions

static const TopicManagerPtrinstance ()
 

Private Member Functions

bool addSubCallback (const SubscribeOptions &ops)
 
void getBusInfo (XmlRpc::XmlRpcValue &info)
 Compute the info for the node's connectivity. More...
 
void getBusInfoCallback (XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
 
void getBusStats (XmlRpc::XmlRpcValue &stats)
 Compute the statistics for the node's connectivity. More...
 
void getBusStatsCallback (XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
 
void getPublications (XmlRpc::XmlRpcValue &publications)
 Return the list of advertised topics for the node. More...
 
void getPublicationsCallback (XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
 
void getSubscriptions (XmlRpc::XmlRpcValue &subscriptions)
 Return the list of subcriptions for the node. More...
 
void getSubscriptionsCallback (XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
 
bool isShuttingDown ()
 
bool isTopicAdvertised (const std::string &topic)
 
PublicationPtr lookupPublicationWithoutLock (const std::string &topic)
 
void processPublishQueues ()
 
bool pubUpdate (const std::string &topic, const std::vector< std::string > &pubs)
 Update local publisher lists. More...
 
void pubUpdateCallback (XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
 
bool registerSubscriber (const SubscriptionPtr &s, const std::string &datatype)
 
bool requestTopic (const std::string &topic, XmlRpc::XmlRpcValue &protos, XmlRpc::XmlRpcValue &ret)
 Request a topic. More...
 
void requestTopicCallback (XmlRpc::XmlRpcValue &params, XmlRpc::XmlRpcValue &result)
 
bool unregisterPublisher (const std::string &topic)
 
bool unregisterSubscriber (const std::string &topic)
 

Private Attributes

std::list< std::string > advertised_topic_names_
 
boost::mutex advertised_topic_names_mutex_
 
V_Publication advertised_topics_
 
boost::recursive_mutex advertised_topics_mutex_
 
ConnectionManagerPtr connection_manager_
 
PollManagerPtr poll_manager_
 
volatile bool shutting_down_
 
boost::mutex shutting_down_mutex_
 
boost::mutex subs_mutex_
 
L_Subscription subscriptions_
 
XMLRPCManagerPtr xmlrpc_manager_
 

Detailed Description

Definition at line 63 of file topic_manager.h.

Constructor & Destructor Documentation

◆ TopicManager()

ros::TopicManager::TopicManager ( )

Definition at line 62 of file topic_manager.cpp.

◆ ~TopicManager()

ros::TopicManager::~TopicManager ( )

Definition at line 67 of file topic_manager.cpp.

Member Function Documentation

◆ addSubCallback()

bool ros::TopicManager::addSubCallback ( const SubscribeOptions ops)
private

if it finds a pre-existing subscription to the same topic and of the same message type, it appends the Functor to the callback vector for that subscription. otherwise, it returns false, indicating that a new subscription needs to be created.

Definition at line 198 of file topic_manager.cpp.

◆ advertise()

bool ros::TopicManager::advertise ( const AdvertiseOptions ops,
const SubscriberCallbacksPtr callbacks 
)

Definition at line 293 of file topic_manager.cpp.

◆ getAdvertisedTopics()

void ros::TopicManager::getAdvertisedTopics ( V_string topics)

Get the list of topics advertised by this node.

Parameters
[out]topicsThe advertised topics

Definition at line 162 of file topic_manager.cpp.

◆ getBusInfo()

void ros::TopicManager::getBusInfo ( XmlRpc::XmlRpcValue info)
private

Compute the info for the node's connectivity.

This is the implementation of the xml-rpc getBusInfo function; it populates the XmlRpcValue object sent to it with various info about the node's connectivity.

Definition at line 937 of file topic_manager.cpp.

◆ getBusInfoCallback()

void ros::TopicManager::getBusInfoCallback ( XmlRpc::XmlRpcValue params,
XmlRpc::XmlRpcValue result 
)
private

Definition at line 1039 of file topic_manager.cpp.

◆ getBusStats()

void ros::TopicManager::getBusStats ( XmlRpc::XmlRpcValue stats)
private

Compute the statistics for the node's connectivity.

This is the implementation of the xml-rpc getBusStats function; it populates the XmlRpcValue object sent to it with various statistics about the node's connectivity, bandwidth utilization, etc.

Definition at line 904 of file topic_manager.cpp.

◆ getBusStatsCallback()

void ros::TopicManager::getBusStatsCallback ( XmlRpc::XmlRpcValue params,
XmlRpc::XmlRpcValue result 
)
private

Definition at line 1029 of file topic_manager.cpp.

◆ getNumPublishers()

size_t ros::TopicManager::getNumPublishers ( const std::string &  _topic)

Return the number of publishers connected to this node on a particular topic.

Parameters
_topicthe topic name to check
Returns
the number of subscribers

Definition at line 883 of file topic_manager.cpp.

◆ getNumSubscribers()

size_t ros::TopicManager::getNumSubscribers ( const std::string &  _topic)

Return the number of subscribers a node has for a particular topic:

Parameters
_topicThe topic name to check
Returns
number of subscribers

Definition at line 859 of file topic_manager.cpp.

◆ getNumSubscriptions()

size_t ros::TopicManager::getNumSubscriptions ( )

Definition at line 877 of file topic_manager.cpp.

◆ getPublications()

void ros::TopicManager::getPublications ( XmlRpc::XmlRpcValue publications)
private

Return the list of advertised topics for the node.

This is the implementation of the xml-rpc getPublications function; it populates the XmlRpcValue object sent to it with the list of advertised topics and their datatypes.

Definition at line 982 of file topic_manager.cpp.

◆ getPublicationsCallback()

void ros::TopicManager::getPublicationsCallback ( XmlRpc::XmlRpcValue params,
XmlRpc::XmlRpcValue result 
)
private

Definition at line 1059 of file topic_manager.cpp.

◆ getSubscribedTopics()

void ros::TopicManager::getSubscribedTopics ( V_string topics)

Get the list of topics subscribed to by this node.

Parameters
[out]Thesubscribed topics

Definition at line 172 of file topic_manager.cpp.

◆ getSubscriptions()

void ros::TopicManager::getSubscriptions ( XmlRpc::XmlRpcValue subscriptions)
private

Return the list of subcriptions for the node.

This is the implementation of the xml-rpc getSubscriptions function; it populates the XmlRpcValue object sent to it with the list of subscribed topics and their datatypes.

Definition at line 962 of file topic_manager.cpp.

◆ getSubscriptionsCallback()

void ros::TopicManager::getSubscriptionsCallback ( XmlRpc::XmlRpcValue params,
XmlRpc::XmlRpcValue result 
)
private

Definition at line 1049 of file topic_manager.cpp.

◆ incrementSequence()

void ros::TopicManager::incrementSequence ( const std::string &  _topic)

Definition at line 762 of file topic_manager.cpp.

◆ instance()

const TopicManagerPtr & ros::TopicManager::instance ( )
static

Definition at line 56 of file topic_manager.cpp.

◆ isLatched()

bool ros::TopicManager::isLatched ( const std::string &  topic)

Definition at line 771 of file topic_manager.cpp.

◆ isShuttingDown()

bool ros::TopicManager::isShuttingDown ( )
inlineprivate

Definition at line 219 of file topic_manager.h.

◆ isTopicAdvertised()

bool ros::TopicManager::isTopicAdvertised ( const std::string &  topic)
private

Definition at line 462 of file topic_manager.cpp.

◆ lookupPublication()

PublicationPtr ros::TopicManager::lookupPublication ( const std::string &  topic)

Lookup an advertised topic.

This method iterates over advertised_topics, looking for one with name matching the given topic name. The advertised_topics_mutex is locked during this search. This method is only used internally.

Parameters
topicThe topic name to look for.
Returns
Pointer to the matching Publication, NULL if none is found.

Definition at line 186 of file topic_manager.cpp.

◆ lookupPublicationWithoutLock()

PublicationPtr ros::TopicManager::lookupPublicationWithoutLock ( const std::string &  topic)
private

Definition at line 782 of file topic_manager.cpp.

◆ processPublishQueues()

void ros::TopicManager::processPublishQueues ( )
private

Definition at line 149 of file topic_manager.cpp.

◆ publish() [1/2]

template<typename M >
void ros::TopicManager::publish ( const std::string &  topic,
const M &  message 
)
inline

Definition at line 122 of file topic_manager.h.

◆ publish() [2/2]

void ros::TopicManager::publish ( const std::string &  _topic,
const boost::function< SerializedMessage(void)> &  serfunc,
SerializedMessage m 
)

Definition at line 704 of file topic_manager.cpp.

◆ pubUpdate()

bool ros::TopicManager::pubUpdate ( const std::string &  topic,
const std::vector< std::string > &  pubs 
)
private

Update local publisher lists.

Use this method to update address information for publishers on a given topic.

Parameters
topicThe topic of interest
pubsThe list of publishers to update.
Returns
true on success, false otherwise.

Definition at line 550 of file topic_manager.cpp.

◆ pubUpdateCallback()

void ros::TopicManager::pubUpdateCallback ( XmlRpc::XmlRpcValue params,
XmlRpc::XmlRpcValue result 
)
private

Definition at line 1004 of file topic_manager.cpp.

◆ registerSubscriber()

bool ros::TopicManager::registerSubscriber ( const SubscriptionPtr s,
const std::string &  datatype 
)
private

Definition at line 475 of file topic_manager.cpp.

◆ requestTopic()

bool ros::TopicManager::requestTopic ( const std::string &  topic,
XmlRpc::XmlRpcValue protos,
XmlRpc::XmlRpcValue ret 
)
private

Request a topic.

Negotiate a subscriber connection on a topic.

Parameters
topicThe topic of interest.
protosList of transport protocols, in preference order
retReturn value
Returns
true on success, false otherwise
Todo:
Consider making this private

Definition at line 588 of file topic_manager.cpp.

◆ requestTopicCallback()

void ros::TopicManager::requestTopicCallback ( XmlRpc::XmlRpcValue params,
XmlRpc::XmlRpcValue result 
)
private

Definition at line 1021 of file topic_manager.cpp.

◆ shutdown()

void ros::TopicManager::shutdown ( )

Definition at line 91 of file topic_manager.cpp.

◆ start()

void ros::TopicManager::start ( )

Definition at line 72 of file topic_manager.cpp.

◆ subscribe()

bool ros::TopicManager::subscribe ( const SubscribeOptions ops)

Definition at line 246 of file topic_manager.cpp.

◆ unadvertise()

bool ros::TopicManager::unadvertise ( const std::string &  topic,
const SubscriberCallbacksPtr callbacks 
)

Definition at line 402 of file topic_manager.cpp.

◆ unregisterPublisher()

bool ros::TopicManager::unregisterPublisher ( const std::string &  topic)
private

Definition at line 451 of file topic_manager.cpp.

◆ unregisterSubscriber()

bool ros::TopicManager::unregisterSubscriber ( const std::string &  topic)
private

Definition at line 538 of file topic_manager.cpp.

◆ unsubscribe()

bool ros::TopicManager::unsubscribe ( const std::string &  _topic,
const SubscriptionCallbackHelperPtr helper 
)

Definition at line 798 of file topic_manager.cpp.

Member Data Documentation

◆ advertised_topic_names_

std::list<std::string> ros::TopicManager::advertised_topic_names_
private

Definition at line 226 of file topic_manager.h.

◆ advertised_topic_names_mutex_

boost::mutex ros::TopicManager::advertised_topic_names_mutex_
private

Definition at line 227 of file topic_manager.h.

◆ advertised_topics_

V_Publication ros::TopicManager::advertised_topics_
private

Definition at line 225 of file topic_manager.h.

◆ advertised_topics_mutex_

boost::recursive_mutex ros::TopicManager::advertised_topics_mutex_
private

Definition at line 224 of file topic_manager.h.

◆ connection_manager_

ConnectionManagerPtr ros::TopicManager::connection_manager_
private

Definition at line 233 of file topic_manager.h.

◆ poll_manager_

PollManagerPtr ros::TopicManager::poll_manager_
private

Definition at line 232 of file topic_manager.h.

◆ shutting_down_

volatile bool ros::TopicManager::shutting_down_
private

Definition at line 229 of file topic_manager.h.

◆ shutting_down_mutex_

boost::mutex ros::TopicManager::shutting_down_mutex_
private

Definition at line 230 of file topic_manager.h.

◆ subs_mutex_

boost::mutex ros::TopicManager::subs_mutex_
private

Definition at line 221 of file topic_manager.h.

◆ subscriptions_

L_Subscription ros::TopicManager::subscriptions_
private

Definition at line 222 of file topic_manager.h.

◆ xmlrpc_manager_

XMLRPCManagerPtr ros::TopicManager::xmlrpc_manager_
private

Definition at line 234 of file topic_manager.h.


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


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Wed Oct 16 2019 03:27:44