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 (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.
void callAvailable ()
 Invoke all callbacks currently in the queue. If a callback was not ready to be called, pushes it back onto the queue.
 CallbackQueue (bool enabled=true)
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.
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.
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 44 of file callback_queue.h.


Member Typedef Documentation

typedef std::deque<CallbackInfo> ros::CallbackQueue::D_CallbackInfo [protected]

Definition at line 143 of file callback_queue.h.

typedef boost::shared_ptr<IDInfo> ros::CallbackQueue::IDInfoPtr [protected]

Definition at line 127 of file callback_queue.h.

typedef std::list<CallbackInfo> ros::CallbackQueue::L_CallbackInfo [protected]

Definition at line 142 of file callback_queue.h.

typedef std::map<uint64_t, IDInfoPtr> ros::CallbackQueue::M_IDInfo [protected]

Definition at line 128 of file callback_queue.h.


Member Enumeration Documentation

Enumerator:
Called 
TryAgain 
Disabled 
Empty 

Definition at line 47 of file callback_queue.h.


Constructor & Destructor Documentation

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

Definition at line 38 of file callback_queue.cpp.

ros::CallbackQueue::~CallbackQueue (  )  [virtual]

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

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.

Parameters:
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 287 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 77 of file callback_queue.h.

CallbackQueue::CallOneResult ros::CallbackQueue::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.

Parameters:
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 209 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 59 of file callback_queue.h.

CallbackQueue::CallOneResult ros::CallbackQueue::callOneCB ( TLS tls  )  [protected]

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

void ros::CallbackQueue::disable (  ) 

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

Definition at line 57 of file callback_queue.cpp.

bool ros::CallbackQueue::empty (  )  [inline]

returns whether or not the queue is empty

Definition at line 93 of file callback_queue.h.

void ros::CallbackQueue::enable (  ) 

Enable the queue (queue is enabled by default).

Definition at line 49 of file callback_queue.cpp.

CallbackQueue::IDInfoPtr ros::CallbackQueue::getIDInfo ( uint64_t  id  )  [protected]

Definition at line 126 of file callback_queue.cpp.

bool ros::CallbackQueue::isEmpty (  ) 

returns whether or not the queue is empty

Definition at line 72 of file callback_queue.cpp.

bool ros::CallbackQueue::isEnabled (  ) 

Returns whether or not this queue is enabled.

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

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

Definition at line 86 of file callback_queue.cpp.


Member Data Documentation

Definition at line 144 of file callback_queue.h.

size_t ros::CallbackQueue::calling_ [protected]

Definition at line 145 of file callback_queue.h.

boost::condition_variable ros::CallbackQueue::condition_ [protected]

Definition at line 147 of file callback_queue.h.

bool ros::CallbackQueue::enabled_ [protected]

Definition at line 164 of file callback_queue.h.

Definition at line 150 of file callback_queue.h.

boost::mutex ros::CallbackQueue::id_info_mutex_ [protected]

Definition at line 149 of file callback_queue.h.

boost::mutex ros::CallbackQueue::mutex_ [protected]

Definition at line 146 of file callback_queue.h.

boost::thread_specific_ptr<TLS> ros::CallbackQueue::tls_ [protected]

Definition at line 162 of file callback_queue.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


roscpp
Author(s): Morgan Quigley mquigley@cs.stanford.edu, Josh Faust jfaust@willowgarage.com, Brian Gerkey gerkey@willowgarage.com
autogenerated on Fri Jan 11 10:08:40 2013