Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
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]

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. More...
 
void callAvailable ()
 Invoke all callbacks currently in the queue. If a callback was not ready to be called, pushes it back onto the queue. More...
 
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. More...
 
 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. More...
 
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. More...
 
void clear ()
 Removes all callbacks from the queue. Does not wait for calls currently in progress to finish. More...
 
void disable ()
 Disable the queue, meaning any calls to addCallback() will have no effect. More...
 
bool empty ()
 returns whether or not the queue is empty More...
 
void enable ()
 Enable the queue (queue is enabled by default) More...
 
bool isEmpty ()
 returns whether or not the queue is empty More...
 
bool isEnabled ()
 Returns whether or not this queue is enabled. More...
 
virtual void removeByID (uint64_t removal_id)
 Remove all callbacks associated with an owner id. More...
 
virtual ~CallbackQueue ()
 
- Public Member Functions inherited from ros::CallbackQueueInterface
virtual ~CallbackQueueInterface ()
 

Protected Types

typedef std::deque< CallbackInfoD_CallbackInfo
 
typedef boost::shared_ptr< IDInfoIDInfoPtr
 
typedef std::list< CallbackInfoL_CallbackInfo
 
typedef std::map< uint64_t, IDInfoPtrM_IDInfo
 

Protected Member Functions

CallOneResult callOneCB (TLS *tls)
 
IDInfoPtr getIDInfo (uint64_t id)
 
void setupTLS ()
 

Protected Attributes

D_CallbackInfo callbacks_
 
size_t calling_
 
ros::internal::condition_variable_monotonic 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.

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

ros::CallbackQueue::~CallbackQueue ( )
virtual

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

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 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.

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
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 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.

Member Data Documentation

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.

ros::internal::condition_variable_monotonic 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.


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


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
autogenerated on Mon Nov 2 2020 03:52:27