#include <ros_publish_activity.hpp>
Public Types | |
typedef boost::shared_ptr < RosPublishActivity > | shared_ptr |
Public Member Functions | |
void | addPublisher (RosPublisher *pub) |
void | removePublisher (RosPublisher *pub) |
bool | requestPublish (RosPublisher *chan) |
~RosPublishActivity () | |
Static Public Member Functions | |
static shared_ptr | Instance () |
Private Types | |
typedef std::map< RosPublisher *, bool > | Publishers |
typedef boost::weak_ptr < RosPublishActivity > | weak_ptr |
Private Member Functions | |
void | loop () |
RosPublishActivity (const std::string &name) | |
Private Attributes | |
os::Mutex | map_lock |
Publishers | publishers |
Static Private Attributes | |
static weak_ptr | ros_pub_act |
This pointer may not be refcounted since it would prevent cleanup. |
A process wide thread that handles all publishing of ROS topics of the current process. There is no strong reason why only one publisher should exist, in later implementations, one publisher thread per channel may exist as well. See the usage recommendations for Instance()
Definition at line 65 of file ros_publish_activity.hpp.
typedef std::map< RosPublisher*, bool> ros_integration::RosPublishActivity::Publishers [private] |
A map keeping track of all publishers in the current process. It must be guarded by the mutex since insertion/removal happens concurrently.
Definition at line 76 of file ros_publish_activity.hpp.
typedef boost::shared_ptr<RosPublishActivity> ros_integration::RosPublishActivity::shared_ptr |
Definition at line 67 of file ros_publish_activity.hpp.
typedef boost::weak_ptr<RosPublishActivity> ros_integration::RosPublishActivity::weak_ptr [private] |
Definition at line 69 of file ros_publish_activity.hpp.
ros_integration::RosPublishActivity::RosPublishActivity | ( | const std::string & | name | ) | [inline, private] |
Definition at line 80 of file ros_publish_activity.hpp.
ros_integration::RosPublishActivity::~RosPublishActivity | ( | ) | [inline] |
Definition at line 139 of file ros_publish_activity.hpp.
void ros_integration::RosPublishActivity::addPublisher | ( | RosPublisher * | pub | ) | [inline] |
Definition at line 113 of file ros_publish_activity.hpp.
static shared_ptr ros_integration::RosPublishActivity::Instance | ( | ) | [inline, static] |
Returns the single instance of the RosPublisher. This function is not thread-safe when it creates the RosPublisher object. Therefor, it is advised to cache the object which Intance() returns such that, in the unlikely event that two publishers exist, you consistently keep using the same instance, which is fine then.
Definition at line 103 of file ros_publish_activity.hpp.
void ros_integration::RosPublishActivity::loop | ( | ) | [inline, private] |
Definition at line 87 of file ros_publish_activity.hpp.
void ros_integration::RosPublishActivity::removePublisher | ( | RosPublisher * | pub | ) | [inline] |
Definition at line 118 of file ros_publish_activity.hpp.
bool ros_integration::RosPublishActivity::requestPublish | ( | RosPublisher * | chan | ) | [inline] |
Requests to publish the data of a given channel. Note that multiple calls to requestPublish may cause only a single call to RosPublisher::publish().
Definition at line 128 of file ros_publish_activity.hpp.
os::Mutex ros_integration::RosPublishActivity::map_lock [private] |
Definition at line 78 of file ros_publish_activity.hpp.
Definition at line 77 of file ros_publish_activity.hpp.
RosPublishActivity::weak_ptr ros_integration::RosPublishActivity::ros_pub_act [static, private] |
This pointer may not be refcounted since it would prevent cleanup.
Definition at line 71 of file ros_publish_activity.hpp.