A Publication manages an advertised topic. More...
#include <publication.h>
Public Member Functions | |
void | addCallbacks (const SubscriberCallbacksPtr &callbacks) |
void | addSubscriberLink (const SubscriberLinkPtr &sub_link) |
Adds a publisher to our list. | |
void | drop () |
Drop this publication. Disconnects all publishers. | |
bool | enqueueMessage (const SerializedMessage &m) |
queues an outgoing message into each of the publishers, so that it gets sent to every subscriber | |
const std::string & | getDataType () const |
Returns the data type of the message published by this publication. | |
void | getInfo (XmlRpc::XmlRpcValue &info) |
Get the accumulated info for this publication. | |
size_t | getMaxQueue () |
returns the max queue size of this publication | |
const std::string & | getMD5Sum () const |
Returns the md5sum of the message published by this publication. | |
const std::string & | getMessageDefinition () const |
Returns the full definition of the message published by this publication. | |
const std::string & | getName () const |
Returns the name of the topic this publication broadcasts to. | |
size_t | getNumCallbacks () |
uint32_t | getNumSubscribers () |
Returns the number of subscribers this publication has. | |
void | getPublishTypes (bool &serialize, bool &nocopy, const std::type_info &ti) |
uint32_t | getSequence () |
Returns the sequence number. | |
XmlRpc::XmlRpcValue | getStats () |
Get the accumulated stats for this publication. | |
bool | hasSubscribers () |
Returns whether or not this publication has any subscribers. | |
uint32_t | incrementSequence () |
bool | isDropped () |
Returns if this publication is valid or not. | |
bool | isLatched () |
bool | isLatching () |
void | processPublishQueue () |
Publication (const std::string &name, const std::string &datatype, const std::string &_md5sum, const std::string &message_definition, size_t max_queue, bool latch, bool has_header) | |
void | publish (SerializedMessage &m) |
void | removeCallbacks (const SubscriberCallbacksPtr &callbacks) |
void | removeSubscriberLink (const SubscriberLinkPtr &sub_link) |
Removes a publisher from our list (deleting it if it's the last reference). | |
bool | validateHeader (const Header &h, std::string &error_msg) |
~Publication () | |
Private Types | |
typedef std::vector < SubscriberCallbacksPtr > | V_Callback |
typedef std::vector < SerializedMessage > | V_SerializedMessage |
Private Member Functions | |
void | dropAllConnections () |
void | peerConnect (const SubscriberLinkPtr &sub_link) |
Called when a new peer has connected. Calls the connection callback. | |
void | peerDisconnect (const SubscriberLinkPtr &sub_link) |
Called when a peer has disconnected. Calls the disconnection callback. | |
Private Attributes | |
V_Callback | callbacks_ |
boost::mutex | callbacks_mutex_ |
std::string | datatype_ |
bool | dropped_ |
bool | has_header_ |
uint32_t | intraprocess_subscriber_count_ |
SerializedMessage | last_message_ |
bool | latch_ |
size_t | max_queue_ |
std::string | md5sum_ |
std::string | message_definition_ |
std::string | name_ |
V_SerializedMessage | publish_queue_ |
boost::mutex | publish_queue_mutex_ |
uint32_t | seq_ |
boost::mutex | seq_mutex_ |
V_SubscriberLink | subscriber_links_ |
boost::mutex | subscriber_links_mutex_ |
A Publication manages an advertised topic.
Definition at line 44 of file publication.h.
typedef std::vector<SubscriberCallbacksPtr> ros::Publication::V_Callback [private] |
Definition at line 160 of file publication.h.
typedef std::vector<SerializedMessage> ros::Publication::V_SerializedMessage [private] |
Definition at line 176 of file publication.h.
ros::Publication::Publication | ( | const std::string & | name, | |
const std::string & | datatype, | |||
const std::string & | _md5sum, | |||
const std::string & | message_definition, | |||
size_t | max_queue, | |||
bool | latch, | |||
bool | has_header | |||
) |
Definition at line 74 of file publication.cpp.
ros::Publication::~Publication | ( | ) |
Definition at line 94 of file publication.cpp.
void ros::Publication::addCallbacks | ( | const SubscriberCallbacksPtr & | callbacks | ) |
Definition at line 99 of file publication.cpp.
void ros::Publication::addSubscriberLink | ( | const SubscriberLinkPtr & | sub_link | ) |
Adds a publisher to our list.
Definition at line 194 of file publication.cpp.
void ros::Publication::drop | ( | ) |
Drop this publication. Disconnects all publishers.
Definition at line 136 of file publication.cpp.
void ros::Publication::dropAllConnections | ( | ) | [private] |
Definition at line 305 of file publication.cpp.
bool ros::Publication::enqueueMessage | ( | const SerializedMessage & | m | ) |
queues an outgoing message into each of the publishers, so that it gets sent to every subscriber
Definition at line 155 of file publication.cpp.
const std::string& ros::Publication::getDataType | ( | ) | const [inline] |
Returns the data type of the message published by this publication.
Definition at line 95 of file publication.h.
void ros::Publication::getInfo | ( | XmlRpc::XmlRpcValue & | info | ) |
Get the accumulated info for this publication.
Definition at line 288 of file publication.cpp.
size_t ros::Publication::getMaxQueue | ( | ) | [inline] |
returns the max queue size of this publication
Definition at line 67 of file publication.h.
const std::string& ros::Publication::getMD5Sum | ( | ) | const [inline] |
Returns the md5sum of the message published by this publication.
Definition at line 99 of file publication.h.
const std::string& ros::Publication::getMessageDefinition | ( | ) | const [inline] |
Returns the full definition of the message published by this publication.
Definition at line 103 of file publication.h.
const std::string& ros::Publication::getName | ( | ) | const [inline] |
Returns the name of the topic this publication broadcasts to.
Definition at line 91 of file publication.h.
size_t ros::Publication::getNumCallbacks | ( | ) |
Definition at line 354 of file publication.cpp.
uint32_t ros::Publication::getNumSubscribers | ( | ) |
Returns the number of subscribers this publication has.
Definition at line 369 of file publication.cpp.
void ros::Publication::getPublishTypes | ( | bool & | serialize, | |
bool & | nocopy, | |||
const std::type_info & | ti | |||
) |
Definition at line 375 of file publication.cpp.
uint32_t ros::Publication::getSequence | ( | ) | [inline] |
Returns the sequence number.
Definition at line 107 of file publication.h.
XmlRpc::XmlRpcValue ros::Publication::getStats | ( | ) |
Get the accumulated stats for this publication.
Definition at line 253 of file publication.cpp.
bool ros::Publication::hasSubscribers | ( | ) |
Returns whether or not this publication has any subscribers.
Definition at line 396 of file publication.cpp.
uint32_t ros::Publication::incrementSequence | ( | ) |
Definition at line 360 of file publication.cpp.
bool ros::Publication::isDropped | ( | ) | [inline] |
Returns if this publication is valid or not.
Definition at line 127 of file publication.h.
bool ros::Publication::isLatched | ( | ) | [inline] |
Definition at line 109 of file publication.h.
bool ros::Publication::isLatching | ( | ) | [inline] |
Definition at line 133 of file publication.h.
void ros::Publication::peerConnect | ( | const SubscriberLinkPtr & | sub_link | ) | [private] |
Called when a new peer has connected. Calls the connection callback.
Definition at line 324 of file publication.cpp.
void ros::Publication::peerDisconnect | ( | const SubscriberLinkPtr & | sub_link | ) | [private] |
Called when a peer has disconnected. Calls the disconnection callback.
Definition at line 339 of file publication.cpp.
void ros::Publication::processPublishQueue | ( | ) |
Definition at line 428 of file publication.cpp.
void ros::Publication::publish | ( | SerializedMessage & | m | ) |
Definition at line 402 of file publication.cpp.
void ros::Publication::removeCallbacks | ( | const SubscriberCallbacksPtr & | callbacks | ) |
Definition at line 120 of file publication.cpp.
void ros::Publication::removeSubscriberLink | ( | const SubscriberLinkPtr & | sub_link | ) |
Removes a publisher from our list (deleting it if it's the last reference).
Definition at line 223 of file publication.cpp.
bool ros::Publication::validateHeader | ( | const Header & | h, | |
std::string & | error_msg | |||
) |
Definition at line 456 of file publication.cpp.
V_Callback ros::Publication::callbacks_ [private] |
Definition at line 161 of file publication.h.
boost::mutex ros::Publication::callbacks_mutex_ [private] |
Definition at line 162 of file publication.h.
std::string ros::Publication::datatype_ [private] |
Definition at line 153 of file publication.h.
bool ros::Publication::dropped_ [private] |
Definition at line 168 of file publication.h.
bool ros::Publication::has_header_ [private] |
Definition at line 171 of file publication.h.
uint32_t ros::Publication::intraprocess_subscriber_count_ [private] |
Definition at line 174 of file publication.h.
SerializedMessage ros::Publication::last_message_ [private] |
Definition at line 172 of file publication.h.
bool ros::Publication::latch_ [private] |
Definition at line 170 of file publication.h.
size_t ros::Publication::max_queue_ [private] |
Definition at line 156 of file publication.h.
std::string ros::Publication::md5sum_ [private] |
Definition at line 154 of file publication.h.
std::string ros::Publication::message_definition_ [private] |
Definition at line 155 of file publication.h.
std::string ros::Publication::name_ [private] |
Definition at line 152 of file publication.h.
Definition at line 177 of file publication.h.
boost::mutex ros::Publication::publish_queue_mutex_ [private] |
Definition at line 178 of file publication.h.
uint32_t ros::Publication::seq_ [private] |
Definition at line 157 of file publication.h.
boost::mutex ros::Publication::seq_mutex_ [private] |
Definition at line 158 of file publication.h.
Definition at line 164 of file publication.h.
boost::mutex ros::Publication::subscriber_links_mutex_ [private] |
Definition at line 166 of file publication.h.