A queue of outgoing messages. Instead of calling publish() directly, you can push() messages here to defer ROS serialization and locking. Templated on a ROS message type. More...
#include <PubQueue.h>
Public Types | |
typedef boost::shared_ptr < PubQueue< T > > | Ptr |
typedef boost::shared_ptr < std::deque < boost::shared_ptr < PubMessagePair< T > > > > | QueuePtr |
Public Member Functions | |
void | pop (std::vector< boost::shared_ptr< PubMessagePair< T > > > &els) |
Pop all waiting messages off the queue. | |
PubQueue (QueuePtr queue, boost::shared_ptr< boost::mutex > queue_lock, boost::function< void()> notify_func) | |
void | push (T &msg, ros::Publisher &pub) |
Push a new message onto the queue. | |
~PubQueue () | |
Private Attributes | |
boost::function< void()> | notify_func_ |
Function that will be called when a new message is pushed on. | |
QueuePtr | queue_ |
Our queue of outgoing messages. | |
boost::shared_ptr< boost::mutex > | queue_lock_ |
Mutex to control access to the queue. |
A queue of outgoing messages. Instead of calling publish() directly, you can push() messages here to defer ROS serialization and locking. Templated on a ROS message type.
Definition at line 48 of file PubQueue.h.
Definition at line 53 of file PubQueue.h.
typedef boost::shared_ptr<std::deque<boost::shared_ptr< PubMessagePair<T> > > > PubQueue< T >::QueuePtr |
Definition at line 52 of file PubQueue.h.
PubQueue< T >::PubQueue | ( | QueuePtr | queue, |
boost::shared_ptr< boost::mutex > | queue_lock, | ||
boost::function< void()> | notify_func | ||
) | [inline] |
Definition at line 64 of file PubQueue.h.
Definition at line 68 of file PubQueue.h.
void PubQueue< T >::pop | ( | std::vector< boost::shared_ptr< PubMessagePair< T > > > & | els | ) | [inline] |
Pop all waiting messages off the queue.
[out] | els | Place to store the popped messages |
Definition at line 83 of file PubQueue.h.
void PubQueue< T >::push | ( | T & | msg, |
ros::Publisher & | pub | ||
) | [inline] |
Push a new message onto the queue.
[in] | msg | The outgoing message |
[in] | pub | The ROS publisher to use to publish the message |
Definition at line 73 of file PubQueue.h.
boost::function<void()> PubQueue< T >::notify_func_ [private] |
Function that will be called when a new message is pushed on.
Definition at line 61 of file PubQueue.h.
Our queue of outgoing messages.
Definition at line 57 of file PubQueue.h.
boost::shared_ptr<boost::mutex> PubQueue< T >::queue_lock_ [private] |
Mutex to control access to the queue.
Definition at line 59 of file PubQueue.h.