Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
roswrap::CallbackQueue Class Reference

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

#include <callback_queue.h>

Inheritance diagram for roswrap::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 roswrap::CallbackQueueInterface
virtual ~CallbackQueueInterface ()
 

Protected Types

typedef std::deque< CallbackInfoD_CallbackInfo
 
typedef std::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_
 
std::condition_variable condition_
 
bool enabled_
 
M_IDInfo id_info_
 
std::mutex id_info_mutex_
 
std::mutex mutex_
 
boost::thread_specific_ptr< TLStls_
 

Detailed Description

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

Definition at line 58 of file callback_queue.h.

Member Typedef Documentation

◆ D_CallbackInfo

Definition at line 163 of file callback_queue.h.

◆ IDInfoPtr

typedef std::shared_ptr<IDInfo> roswrap::CallbackQueue::IDInfoPtr
protected

Definition at line 147 of file callback_queue.h.

◆ L_CallbackInfo

Definition at line 162 of file callback_queue.h.

◆ M_IDInfo

typedef std::map<uint64_t, IDInfoPtr> roswrap::CallbackQueue::M_IDInfo
protected

Definition at line 148 of file callback_queue.h.

Member Enumeration Documentation

◆ CallOneResult

Enumerator
Called 
TryAgain 
Disabled 
Empty 

Definition at line 67 of file callback_queue.h.

Constructor & Destructor Documentation

◆ CallbackQueue()

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

◆ ~CallbackQueue()

virtual roswrap::CallbackQueue::~CallbackQueue ( )
virtual

Member Function Documentation

◆ addCallback()

virtual void roswrap::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 roswrap::CallbackQueueInterface.

◆ callAvailable() [1/2]

void roswrap::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 97 of file callback_queue.h.

◆ callAvailable() [2/2]

void roswrap::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.

◆ callOne() [1/2]

CallOneResult roswrap::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 79 of file callback_queue.h.

◆ callOne() [2/2]

CallOneResult roswrap::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.

◆ callOneCB()

CallOneResult roswrap::CallbackQueue::callOneCB ( TLS tls)
protected

◆ clear()

void roswrap::CallbackQueue::clear ( )

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

◆ disable()

void roswrap::CallbackQueue::disable ( )

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

◆ empty()

bool roswrap::CallbackQueue::empty ( )
inline

returns whether or not the queue is empty

Definition at line 113 of file callback_queue.h.

◆ enable()

void roswrap::CallbackQueue::enable ( )

Enable the queue (queue is enabled by default)

◆ getIDInfo()

IDInfoPtr roswrap::CallbackQueue::getIDInfo ( uint64_t  id)
protected

◆ isEmpty()

bool roswrap::CallbackQueue::isEmpty ( )

returns whether or not the queue is empty

◆ isEnabled()

bool roswrap::CallbackQueue::isEnabled ( )

Returns whether or not this queue is enabled.

◆ removeByID()

virtual void roswrap::CallbackQueue::removeByID ( uint64_t  owner_id)
virtual

Remove all callbacks associated with an owner id.

Implements roswrap::CallbackQueueInterface.

◆ setupTLS()

void roswrap::CallbackQueue::setupTLS ( )
protected

Member Data Documentation

◆ callbacks_

D_CallbackInfo roswrap::CallbackQueue::callbacks_
protected

Definition at line 164 of file callback_queue.h.

◆ calling_

size_t roswrap::CallbackQueue::calling_
protected

Definition at line 165 of file callback_queue.h.

◆ condition_

std::condition_variable roswrap::CallbackQueue::condition_
protected

Definition at line 167 of file callback_queue.h.

◆ enabled_

bool roswrap::CallbackQueue::enabled_
protected

Definition at line 184 of file callback_queue.h.

◆ id_info_

M_IDInfo roswrap::CallbackQueue::id_info_
protected

Definition at line 170 of file callback_queue.h.

◆ id_info_mutex_

std::mutex roswrap::CallbackQueue::id_info_mutex_
protected

Definition at line 169 of file callback_queue.h.

◆ mutex_

std::mutex roswrap::CallbackQueue::mutex_
protected

Definition at line 166 of file callback_queue.h.

◆ tls_

boost::thread_specific_ptr<TLS> roswrap::CallbackQueue::tls_
protected

Definition at line 182 of file callback_queue.h.


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


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:15