TDME2 1.9.121
Public Member Functions | Protected Types | Protected Attributes | Private Attributes | List of all members
RealtimeQueue< T > Class Template Reference

Realtime consumer/producer queue. More...

#include <tdme/os/threading/RealtimeQueue.h>

Collaboration diagram for RealtimeQueue< T >:
Collaboration graph

Public Member Functions

 RealtimeQueue (const unsigned int maxElements)
 Public constructor. More...
 
virtual ~RealtimeQueue ()
 Destructor, removes remaining elements from queue. More...
 
void stop ()
 Requests this queue to be stopped. More...
 
T * getElement ()
 Gets an element from this queue, if no element exists it will immediately return NULL. More...
 
bool addElement (T *element, const bool declinable)
 Adds an element to this queue. More...
 

Protected Types

typedef queue< T * > RealtimeQueueType
 

Protected Attributes

RealtimeQueueType data
 
unsigned int maxElements
 

Private Attributes

SpinLock m
 
volatile bool stopRequested
 

Detailed Description

template<typename T>
class tdme::os::threading::RealtimeQueue< T >

Realtime consumer/producer queue.

Author
Andreas Drewke

Definition at line 22 of file RealtimeQueue.h.

Member Typedef Documentation

◆ RealtimeQueueType

typedef queue<T*> RealtimeQueueType
protected

Definition at line 91 of file RealtimeQueue.h.

Constructor & Destructor Documentation

◆ RealtimeQueue()

RealtimeQueue ( const unsigned int  maxElements)
inline

Public constructor.

Definition at line 27 of file RealtimeQueue.h.

◆ ~RealtimeQueue()

virtual ~RealtimeQueue ( )
inlinevirtual

Destructor, removes remaining elements from queue.

Definition at line 37 of file RealtimeQueue.h.

Member Function Documentation

◆ addElement()

bool addElement ( T *  element,
const bool  declinable 
)
inline

Adds an element to this queue.

Parameters
elementT* element
declinablebool if element is declinable
Returns
if element was added

Definition at line 79 of file RealtimeQueue.h.

◆ getElement()

T * getElement ( )
inline

Gets an element from this queue, if no element exists it will immediately return NULL.

Returns
T*

Definition at line 56 of file RealtimeQueue.h.

◆ stop()

void stop ( )
inline

Requests this queue to be stopped.

Definition at line 48 of file RealtimeQueue.h.

Member Data Documentation

◆ data

RealtimeQueueType data
protected

Definition at line 92 of file RealtimeQueue.h.

◆ m

SpinLock m
private

Definition at line 96 of file RealtimeQueue.h.

◆ maxElements

unsigned int maxElements
protected

Definition at line 93 of file RealtimeQueue.h.

◆ stopRequested

volatile bool stopRequested
private

Definition at line 97 of file RealtimeQueue.h.


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