Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
ros::CallbackQueue Class Reference

This is the default implementation of the ros::CallbackQueueInterface. More...

#include <callback_queue.h>

Inheritance diagram for ros::CallbackQueue:
Inheritance graph
[legend]

List of all members.

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< CallbackInfoD_CallbackInfo
typedef boost::shared_ptr< IDInfoIDInfoPtr
typedef std::list< CallbackInfoL_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< TLStls_

Detailed Description

This is the default implementation of the ros::CallbackQueueInterface.

Definition at line 57 of file callback_queue.h.


Member Typedef Documentation

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.


Member Enumeration Documentation

Enumerator:
Called 
TryAgain 
Disabled 
Empty 

Definition at line 66 of file callback_queue.h.


Constructor & Destructor Documentation

ros::CallbackQueue::CallbackQueue ( bool  enabled = true)

Definition at line 41 of file callback_queue.cpp.

Definition at line 47 of file callback_queue.cpp.


Member Function Documentation

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 97 of file callback_queue.cpp.

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.

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.

Parameters:
timeoutThe 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 290 of file callback_queue.cpp.

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.

Parameters:
timeoutThe 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 212 of file callback_queue.cpp.

Definition at line 345 of file callback_queue.cpp.

Removes all callbacks from the queue. Does not wait for calls currently in progress to finish.

Definition at line 68 of file callback_queue.cpp.

Disable the queue, meaning any calls to addCallback() will have no effect.

Definition at line 60 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.

Enable the queue (queue is enabled by default)

Definition at line 52 of file callback_queue.cpp.

Definition at line 129 of file callback_queue.cpp.

returns whether or not the queue is empty

Definition at line 75 of file callback_queue.cpp.

Returns whether or not this queue is enabled.

Definition at line 82 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 141 of file callback_queue.cpp.

void ros::CallbackQueue::setupTLS ( ) [protected]

Definition at line 89 of file callback_queue.cpp.


Member Data Documentation

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.

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.


The documentation for this class was generated from the following files:


roscpp
Author(s): Morgan Quigley mquigley@cs.stanford.edu, Josh Faust jfaust@willowgarage.com, Brian Gerkey gerkey@willowgarage.com, Troy Straszheim straszheim@willowgarage.com
autogenerated on Sat Dec 28 2013 17:35:53