Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
roswrap::Publisher Class Reference

Manages an advertisement on a specific topic. More...

#include <publisher.h>

Classes

class  Impl
 

Public Member Functions

uint32_t getNumSubscribers () const
 Returns the number of subscribers that are currently connected to this Publisher. More...
 
std::string getTopic () const
 Returns the topic that this Publisher will publish on. More...
 
bool isLatched () const
 Returns whether or not this topic is latched. More...
 
 operator void * () const
 
bool operator!= (const Publisher &rhs) const
 
bool operator< (const Publisher &rhs) const
 
bool operator== (const Publisher &rhs) const
 
template<typename M >
void publish (const M &message) const
 Publish a message on the topic associated with this Publisher. More...
 
template<typename M >
void publish (const std::shared_ptr< M > &message) const
 Publish a message on the topic associated with this Publisher. More...
 
 Publisher ()
 
 Publisher (const Publisher &rhs)
 
void shutdown ()
 Shutdown the advertisement associated with this Publisher. More...
 
 ~Publisher ()
 

Private Types

typedef std::shared_ptr< ImplImplPtr
 
typedef std::weak_ptr< ImplImplWPtr
 

Private Member Functions

void incrementSequence () const
 
void publish (const std::function< SerializedMessage(void)> &serfunc, SerializedMessage &m) const
 
 Publisher (const std::string &topic, const std::string &md5sum, const std::string &datatype, const NodeHandle &node_handle, const SubscriberCallbacksPtr &callbacks)
 

Private Attributes

ImplPtr impl_
 

Friends

class NodeHandle
 
class NodeHandleBackingCollection
 

Detailed Description

Manages an advertisement on a specific topic.

A Publisher should always be created through a call to NodeHandle::advertise(), or copied from one that was. Once all copies of a specific Publisher go out of scope, any subscriber status callbacks associated with that handle will stop being called. Once all Publishers for a given topic go out of scope the topic will be unadvertised.

Definition at line 48 of file ros/publisher.h.

Member Typedef Documentation

◆ ImplPtr

typedef std::shared_ptr<Impl> roswrap::Publisher::ImplPtr
private

Definition at line 194 of file ros/publisher.h.

◆ ImplWPtr

typedef std::weak_ptr<Impl> roswrap::Publisher::ImplWPtr
private

Definition at line 195 of file ros/publisher.h.

Constructor & Destructor Documentation

◆ Publisher() [1/3]

roswrap::Publisher::Publisher ( )
inline

Definition at line 51 of file ros/publisher.h.

◆ Publisher() [2/3]

roswrap::Publisher::Publisher ( const Publisher rhs)

◆ ~Publisher()

roswrap::Publisher::~Publisher ( )

◆ Publisher() [3/3]

roswrap::Publisher::Publisher ( const std::string &  topic,
const std::string &  md5sum,
const std::string &  datatype,
const NodeHandle node_handle,
const SubscriberCallbacksPtr callbacks 
)
private

Member Function Documentation

◆ getNumSubscribers()

uint32_t roswrap::Publisher::getNumSubscribers ( ) const

Returns the number of subscribers that are currently connected to this Publisher.

◆ getTopic()

std::string roswrap::Publisher::getTopic ( ) const

Returns the topic that this Publisher will publish on.

◆ incrementSequence()

void roswrap::Publisher::incrementSequence ( ) const
private

◆ isLatched()

bool roswrap::Publisher::isLatched ( ) const

Returns whether or not this topic is latched.

◆ operator void *()

roswrap::Publisher::operator void * ( ) const
inline

Definition at line 152 of file ros/publisher.h.

◆ operator!=()

bool roswrap::Publisher::operator!= ( const Publisher rhs) const
inline

Definition at line 164 of file ros/publisher.h.

◆ operator<()

bool roswrap::Publisher::operator< ( const Publisher rhs) const
inline

Definition at line 154 of file ros/publisher.h.

◆ operator==()

bool roswrap::Publisher::operator== ( const Publisher rhs) const
inline

Definition at line 159 of file ros/publisher.h.

◆ publish() [1/3]

template<typename M >
void roswrap::Publisher::publish ( const M &  message) const
inline

Publish a message on the topic associated with this Publisher.

Definition at line 96 of file ros/publisher.h.

◆ publish() [2/3]

void roswrap::Publisher::publish ( const std::function< SerializedMessage(void)> &  serfunc,
SerializedMessage m 
) const
private

◆ publish() [3/3]

template<typename M >
void roswrap::Publisher::publish ( const std::shared_ptr< M > &  message) const
inline

Publish a message on the topic associated with this Publisher.

This version of publish will allow fast intra-process message-passing in the future, so you may not mutate the message after it has been passed in here (since it will be passed directly into a callback function)

Definition at line 64 of file ros/publisher.h.

◆ shutdown()

void roswrap::Publisher::shutdown ( )

Shutdown the advertisement associated with this Publisher.

This method usually does not need to be explicitly called, as automatic shutdown happens when all copies of this Publisher go out of scope

This method overrides the automatic reference counted unadvertise, and does so immediately.

Note
Note that if multiple advertisements were made through NodeHandle::advertise(), this will only remove the one associated with this Publisher

Friends And Related Function Documentation

◆ NodeHandle

friend class NodeHandle
friend

Definition at line 199 of file ros/publisher.h.

◆ NodeHandleBackingCollection

friend class NodeHandleBackingCollection
friend

Definition at line 200 of file ros/publisher.h.

Member Data Documentation

◆ impl_

ImplPtr roswrap::Publisher::impl_
private

Definition at line 197 of file ros/publisher.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