Manages topics and their subscriptions. More...
#include <TopicManager.hh>
Public Types | |
typedef std::map< std::string, std::list< NodePtr > > | SubNodeMap |
Public Member Functions | |
void | AddNode (NodePtr _node) |
template<typename M > | |
PublisherPtr | Advertise (const std::string &_topic, unsigned int _queueLimit, bool _latch) |
Advertise on a topic. | |
void | ClearBuffers () |
void | ConnectPubToSub (const std::string &topic, const SubscriptionTransportPtr &sublink) |
Connection a local Publisher to a remote Subscriber. | |
void | ConnectSubscribers (const std::string &topic) |
Connect all subscribers on a topic to known publishers. | |
void | ConnectSubToPub (const msgs::Publish &_pub) |
Connect a local Subscriber to a remote Publisher. | |
void | DisconnectPubFromSub (const std::string &topic, const std::string &host, unsigned int port) |
Disconnect a local publisher from a remote subscriber. | |
void | DisconnectSubFromPub (const std::string &topic, const std::string &host, unsigned int port) |
Disconnection all local subscribers from a remote publisher. | |
PublicationPtr | FindPublication (const std::string &topic) |
void | Fini () |
void | GetTopicNamespaces (std::list< std::string > &_namespaces) |
Get all the topic namespaces. | |
void | Init () |
bool | IsAdvertised (const std::string &_topic) |
Returns true if the topic has been advertised. | |
void | PauseIncoming (bool _pause) |
void | ProcessNodes (bool _onlyOut=false) |
void | Publish (const std::string &topic, const google::protobuf::Message &message, const boost::function< void()> &cb=NULL) |
Send a message. | |
void | RegisterTopicNamespace (const std::string &_name) |
Register a new topic namespace. | |
void | RemoveNode (unsigned int _id) |
SubscriberPtr | Subscribe (const SubscribeOptions &options) |
Subscribe to a topic. | |
void | Unadvertise (const std::string &topic) |
Stop advertising on a topic. | |
void | Unsubscribe (const std::string &_topic, const NodePtr &_sub) |
Unsubscribe from a topic. | |
PublicationPtr | UpdatePublications (const std::string &topic, const std::string &msgType) |
Update our list of advertised topics. | |
Additional Inherited Members | |
![]() | |
static T * | Instance () |
Get an instance of the singleton. | |
![]() | |
SingletonT () | |
Constructor. | |
virtual | ~SingletonT () |
Destructor. | |
Manages topics and their subscriptions.
typedef std::map<std::string, std::list<NodePtr> > gazebo::transport::TopicManager::SubNodeMap |
void gazebo::transport::TopicManager::AddNode | ( | NodePtr | _node | ) |
|
inline |
Advertise on a topic.
topic | The name of the topic |
References gazebo::transport::Publication::AddPublisher(), gazebo::transport::Publication::AddSubscription(), FindPublication(), gazebo::transport::Publication::GetLocallyAdvertised(), gzthrow, SingletonT< T >::Instance(), NULL, gazebo::transport::Publication::SetLocallyAdvertised(), and UpdatePublications().
void gazebo::transport::TopicManager::ClearBuffers | ( | ) |
void gazebo::transport::TopicManager::ConnectPubToSub | ( | const std::string & | topic, |
const SubscriptionTransportPtr & | sublink | ||
) |
Connection a local Publisher to a remote Subscriber.
void gazebo::transport::TopicManager::ConnectSubscribers | ( | const std::string & | topic | ) |
Connect all subscribers on a topic to known publishers.
void gazebo::transport::TopicManager::ConnectSubToPub | ( | const msgs::Publish & | _pub | ) |
Connect a local Subscriber to a remote Publisher.
void gazebo::transport::TopicManager::DisconnectPubFromSub | ( | const std::string & | topic, |
const std::string & | host, | ||
unsigned int | port | ||
) |
Disconnect a local publisher from a remote subscriber.
void gazebo::transport::TopicManager::DisconnectSubFromPub | ( | const std::string & | topic, |
const std::string & | host, | ||
unsigned int | port | ||
) |
Disconnection all local subscribers from a remote publisher.
PublicationPtr gazebo::transport::TopicManager::FindPublication | ( | const std::string & | topic | ) |
Referenced by Advertise().
void gazebo::transport::TopicManager::Fini | ( | ) |
void gazebo::transport::TopicManager::GetTopicNamespaces | ( | std::list< std::string > & | _namespaces | ) |
Get all the topic namespaces.
void gazebo::transport::TopicManager::Init | ( | ) |
bool gazebo::transport::TopicManager::IsAdvertised | ( | const std::string & | _topic | ) |
Returns true if the topic has been advertised.
_topic | The name of the topic to check |
void gazebo::transport::TopicManager::PauseIncoming | ( | bool | _pause | ) |
void gazebo::transport::TopicManager::ProcessNodes | ( | bool | _onlyOut = false | ) |
_onlyOut | True means only outbound messages on nodes will be sent. False means nodes process both outbound and inbound messages |
void gazebo::transport::TopicManager::Publish | ( | const std::string & | topic, |
const google::protobuf::Message & | message, | ||
const boost::function< void()> & | cb = NULL |
||
) |
Send a message.
Use a Publisher instead of calling this function directly.
topic | Name of the topic |
message | The message to send. |
cb | Callback, used when the publish is completed. |
void gazebo::transport::TopicManager::RegisterTopicNamespace | ( | const std::string & | _name | ) |
Register a new topic namespace.
void gazebo::transport::TopicManager::RemoveNode | ( | unsigned int | _id | ) |
SubscriberPtr gazebo::transport::TopicManager::Subscribe | ( | const SubscribeOptions & | options | ) |
Subscribe to a topic.
void gazebo::transport::TopicManager::Unadvertise | ( | const std::string & | topic | ) |
Stop advertising on a topic.
void gazebo::transport::TopicManager::Unsubscribe | ( | const std::string & | _topic, |
const NodePtr & | _sub | ||
) |
Unsubscribe from a topic.
Use a Subscriber rather than calling this function directly
PublicationPtr gazebo::transport::TopicManager::UpdatePublications | ( | const std::string & | topic, |
const std::string & | msgType | ||
) |
Update our list of advertised topics.
Referenced by Advertise().