Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
roswrap::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...
 
void publish (const std::string &_topic, const std::function< SerializedMessage(void)> &serfunc, SerializedMessage &m)
 
template<typename M >
void publish (const std::string &topic, const M &message)
 
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_
 
std::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_
 
std::mutex shutting_down_mutex_
 
std::mutex subs_mutex_
 
L_Subscription subscriptions_
 
XMLRPCManagerPtr xmlrpc_manager_
 

Detailed Description

Definition at line 64 of file topic_manager.h.

Constructor & Destructor Documentation

◆ TopicManager()

roswrap::TopicManager::TopicManager ( )

◆ ~TopicManager()

roswrap::TopicManager::~TopicManager ( )

Member Function Documentation

◆ addSubCallback()

bool roswrap::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.

◆ advertise()

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

◆ getAdvertisedTopics()

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

Get the list of topics advertised by this node.

Parameters
[out]topicsThe advertised topics

◆ getBusInfo()

void roswrap::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.

◆ getBusInfoCallback()

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

◆ getBusStats()

void roswrap::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.

◆ getBusStatsCallback()

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

◆ getNumPublishers()

size_t roswrap::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

◆ getNumSubscribers()

size_t roswrap::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

◆ getNumSubscriptions()

size_t roswrap::TopicManager::getNumSubscriptions ( )

◆ getPublications()

void roswrap::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.

◆ getPublicationsCallback()

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

◆ getSubscribedTopics()

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

Get the list of topics subscribed to by this node.

Parameters
[out]Thesubscribed topics

◆ getSubscriptions()

void roswrap::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.

◆ getSubscriptionsCallback()

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

◆ incrementSequence()

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

◆ instance()

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

◆ isLatched()

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

◆ isShuttingDown()

bool roswrap::TopicManager::isShuttingDown ( )
inlineprivate

Definition at line 220 of file topic_manager.h.

◆ isTopicAdvertised()

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

◆ lookupPublication()

PublicationPtr roswrap::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.

◆ lookupPublicationWithoutLock()

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

◆ processPublishQueues()

void roswrap::TopicManager::processPublishQueues ( )
private

◆ publish() [1/2]

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

◆ publish() [2/2]

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

Definition at line 123 of file topic_manager.h.

◆ pubUpdate()

bool roswrap::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.

◆ pubUpdateCallback()

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

◆ registerSubscriber()

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

◆ requestTopic()

bool roswrap::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

◆ requestTopicCallback()

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

◆ shutdown()

void roswrap::TopicManager::shutdown ( )

◆ start()

void roswrap::TopicManager::start ( )

◆ subscribe()

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

◆ unadvertise()

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

◆ unregisterPublisher()

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

◆ unregisterSubscriber()

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

◆ unsubscribe()

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

Member Data Documentation

◆ advertised_topic_names_

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

Definition at line 227 of file topic_manager.h.

◆ advertised_topic_names_mutex_

std::mutex roswrap::TopicManager::advertised_topic_names_mutex_
private

Definition at line 228 of file topic_manager.h.

◆ advertised_topics_

V_Publication roswrap::TopicManager::advertised_topics_
private

Definition at line 226 of file topic_manager.h.

◆ advertised_topics_mutex_

boost::recursive_mutex roswrap::TopicManager::advertised_topics_mutex_
private

Definition at line 225 of file topic_manager.h.

◆ connection_manager_

ConnectionManagerPtr roswrap::TopicManager::connection_manager_
private

Definition at line 234 of file topic_manager.h.

◆ poll_manager_

PollManagerPtr roswrap::TopicManager::poll_manager_
private

Definition at line 233 of file topic_manager.h.

◆ shutting_down_

volatile bool roswrap::TopicManager::shutting_down_
private

Definition at line 230 of file topic_manager.h.

◆ shutting_down_mutex_

std::mutex roswrap::TopicManager::shutting_down_mutex_
private

Definition at line 231 of file topic_manager.h.

◆ subs_mutex_

std::mutex roswrap::TopicManager::subs_mutex_
private

Definition at line 222 of file topic_manager.h.

◆ subscriptions_

L_Subscription roswrap::TopicManager::subscriptions_
private

Definition at line 223 of file topic_manager.h.

◆ xmlrpc_manager_

XMLRPCManagerPtr roswrap::TopicManager::xmlrpc_manager_
private

Definition at line 235 of file topic_manager.h.


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


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:15