This is the default implementation of the ros::CallbackQueueInterface. More...
#include <callback_queue.h>
Classes | |
struct | CallbackInfo |
struct | IDInfo |
struct | TLS |
Public Types | |
enum | CallOneResult { Called, TryAgain, Disabled, Empty } |
Public Member Functions | |
virtual void | addCallback (const CallbackInterfacePtr &callback, uint64_t removal_id=0) |
Add a callback, with an optional owner id. The owner id can be used to remove a set of callbacks from this queue. | |
void | callAvailable () |
Invoke all callbacks currently in the queue. If a callback was not ready to be called, pushes it back onto the queue. | |
void | callAvailable (ros::WallDuration timeout) |
Invoke all callbacks currently in the queue. If a callback was not ready to be called, pushes it back onto the queue. This version includes a timeout which lets you specify the amount of time to wait for a callback to be available before returning. | |
CallbackQueue (bool enabled=true) | |
CallOneResult | callOne () |
Pop a single callback off the front of the queue and invoke it. If the callback was not ready to be called, pushes it back onto the queue. | |
CallOneResult | callOne (ros::WallDuration timeout) |
Pop a single callback off the front of the queue and invoke it. If the callback was not ready to be called, pushes it back onto the queue. This version includes a timeout which lets you specify the amount of time to wait for a callback to be available before returning. | |
void | clear () |
Removes all callbacks from the queue. Does not wait for calls currently in progress to finish. | |
void | disable () |
Disable the queue, meaning any calls to addCallback() will have no effect. | |
bool | empty () |
returns whether or not the queue is empty | |
void | enable () |
Enable the queue (queue is enabled by default) | |
bool | isEmpty () |
returns whether or not the queue is empty | |
bool | isEnabled () |
Returns whether or not this queue is enabled. | |
virtual void | removeByID (uint64_t removal_id) |
Remove all callbacks associated with an owner id. | |
virtual | ~CallbackQueue () |
Protected Types | |
typedef std::deque< CallbackInfo > | D_CallbackInfo |
typedef boost::shared_ptr< IDInfo > | IDInfoPtr |
typedef std::list< CallbackInfo > | L_CallbackInfo |
typedef std::map< uint64_t, IDInfoPtr > | M_IDInfo |
Protected Member Functions | |
CallOneResult | callOneCB (TLS *tls) |
IDInfoPtr | getIDInfo (uint64_t id) |
void | setupTLS () |
Protected Attributes | |
D_CallbackInfo | callbacks_ |
size_t | calling_ |
boost::condition_variable | condition_ |
bool | enabled_ |
M_IDInfo | id_info_ |
boost::mutex | id_info_mutex_ |
boost::mutex | mutex_ |
boost::thread_specific_ptr< TLS > | tls_ |
This is the default implementation of the ros::CallbackQueueInterface.
Definition at line 57 of file callback_queue.h.
typedef std::deque<CallbackInfo> ros::CallbackQueue::D_CallbackInfo [protected] |
Definition at line 162 of file callback_queue.h.
typedef boost::shared_ptr<IDInfo> ros::CallbackQueue::IDInfoPtr [protected] |
Definition at line 146 of file callback_queue.h.
typedef std::list<CallbackInfo> ros::CallbackQueue::L_CallbackInfo [protected] |
Definition at line 161 of file callback_queue.h.
typedef std::map<uint64_t, IDInfoPtr> ros::CallbackQueue::M_IDInfo [protected] |
Definition at line 147 of file callback_queue.h.
Definition at line 66 of file callback_queue.h.
ros::CallbackQueue::CallbackQueue | ( | bool | enabled = true | ) |
Definition at line 42 of file callback_queue.cpp.
ros::CallbackQueue::~CallbackQueue | ( | ) | [virtual] |
Definition at line 48 of file callback_queue.cpp.
void ros::CallbackQueue::addCallback | ( | const CallbackInterfacePtr & | callback, |
uint64_t | owner_id = 0 |
||
) | [virtual] |
Add a callback, with an optional owner id. The owner id can be used to remove a set of callbacks from this queue.
Implements ros::CallbackQueueInterface.
Definition at line 98 of file callback_queue.cpp.
void ros::CallbackQueue::callAvailable | ( | ) | [inline] |
Invoke all callbacks currently in the queue. If a callback was not ready to be called, pushes it back onto the queue.
Definition at line 96 of file callback_queue.h.
void ros::CallbackQueue::callAvailable | ( | ros::WallDuration | timeout | ) |
Invoke all callbacks currently in the queue. If a callback was not ready to be called, pushes it back onto the queue. This version includes a timeout which lets you specify the amount of time to wait for a callback to be available before returning.
timeout | The amount of time to wait for at least one callback to be available. If there is already at least one callback available, this parameter does nothing. |
Definition at line 291 of file callback_queue.cpp.
CallOneResult ros::CallbackQueue::callOne | ( | ) | [inline] |
Pop a single callback off the front of the queue and invoke it. If the callback was not ready to be called, pushes it back onto the queue.
Definition at line 78 of file callback_queue.h.
Pop a single callback off the front of the queue and invoke it. If the callback was not ready to be called, pushes it back onto the queue. This version includes a timeout which lets you specify the amount of time to wait for a callback to be available before returning.
timeout | The amount of time to wait for a callback to be available. If there is already a callback available, this parameter does nothing. |
Definition at line 213 of file callback_queue.cpp.
CallbackQueue::CallOneResult ros::CallbackQueue::callOneCB | ( | TLS * | tls | ) | [protected] |
Definition at line 346 of file callback_queue.cpp.
void ros::CallbackQueue::clear | ( | ) |
Removes all callbacks from the queue. Does not wait for calls currently in progress to finish.
Definition at line 69 of file callback_queue.cpp.
void ros::CallbackQueue::disable | ( | ) |
Disable the queue, meaning any calls to addCallback() will have no effect.
Definition at line 61 of file callback_queue.cpp.
bool ros::CallbackQueue::empty | ( | ) | [inline] |
returns whether or not the queue is empty
Definition at line 112 of file callback_queue.h.
void ros::CallbackQueue::enable | ( | ) |
Enable the queue (queue is enabled by default)
Definition at line 53 of file callback_queue.cpp.
CallbackQueue::IDInfoPtr ros::CallbackQueue::getIDInfo | ( | uint64_t | id | ) | [protected] |
Definition at line 130 of file callback_queue.cpp.
bool ros::CallbackQueue::isEmpty | ( | ) |
returns whether or not the queue is empty
Definition at line 76 of file callback_queue.cpp.
bool ros::CallbackQueue::isEnabled | ( | ) |
Returns whether or not this queue is enabled.
Definition at line 83 of file callback_queue.cpp.
void ros::CallbackQueue::removeByID | ( | uint64_t | owner_id | ) | [virtual] |
Remove all callbacks associated with an owner id.
Implements ros::CallbackQueueInterface.
Definition at line 142 of file callback_queue.cpp.
void ros::CallbackQueue::setupTLS | ( | ) | [protected] |
Definition at line 90 of file callback_queue.cpp.
D_CallbackInfo ros::CallbackQueue::callbacks_ [protected] |
Definition at line 163 of file callback_queue.h.
size_t ros::CallbackQueue::calling_ [protected] |
Definition at line 164 of file callback_queue.h.
boost::condition_variable ros::CallbackQueue::condition_ [protected] |
Definition at line 166 of file callback_queue.h.
bool ros::CallbackQueue::enabled_ [protected] |
Definition at line 183 of file callback_queue.h.
M_IDInfo ros::CallbackQueue::id_info_ [protected] |
Definition at line 169 of file callback_queue.h.
boost::mutex ros::CallbackQueue::id_info_mutex_ [protected] |
Definition at line 168 of file callback_queue.h.
boost::mutex ros::CallbackQueue::mutex_ [protected] |
Definition at line 165 of file callback_queue.h.
boost::thread_specific_ptr<TLS> ros::CallbackQueue::tls_ [protected] |
Definition at line 181 of file callback_queue.h.