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 49 of file PubQueue.h.
Definition at line 54 of file PubQueue.h.
typedef boost::shared_ptr<std::deque<boost::shared_ptr< PubMessagePair<T> > > > PubQueue< T >::QueuePtr |
Definition at line 53 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 65 of file PubQueue.h.
Definition at line 69 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 84 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 74 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 62 of file PubQueue.h.
Our queue of outgoing messages.
Definition at line 58 of file PubQueue.h.
boost::shared_ptr<boost::mutex> PubQueue< T >::queue_lock_ [private] |
Mutex to control access to the queue.
Definition at line 60 of file PubQueue.h.