Collage  1.7.0
High-performance C++ library for developing object-oriented distributed applications.
co::CommandQueue Class Reference

A thread-safe, blocking queue for ICommand buffers. More...

#include <commandQueue.h>

+ Inheritance diagram for co::CommandQueue:
+ Collaboration diagram for co::CommandQueue:

Public Member Functions

CO_API CommandQueue (const size_t maxSize=ULONG_MAX)
 Construct a new command queue. More...
 
virtual CO_API ~CommandQueue ()
 Destruct a new command queue. More...
 
virtual CO_API void push (const ICommand &command)
 Push a command to the queue. More...
 
virtual CO_API void pushFront (const ICommand &command)
 Push a command to the front of the queue. More...
 
virtual CO_API ICommand pop (const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
 Pop a command from the queue. More...
 
virtual CO_API ICommands popAll (const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
 Pop all, but at least one command from the queue. More...
 
virtual CO_API ICommand tryPop ()
 Try to pop a command from the queue. More...
 
CO_API bool isEmpty () const
 
CO_API void flush ()
 Flush all pending commands. More...
 
CO_API size_t getSize () const
 
virtual void pump ()
 
 LB_TS_VAR (_thread)
 

Detailed Description

A thread-safe, blocking queue for ICommand buffers.

Definition at line 36 of file commandQueue.h.

Constructor & Destructor Documentation

CO_API co::CommandQueue::CommandQueue ( const size_t  maxSize = ULONG_MAX)
explicit

Construct a new command queue.

Parameters
maxSizethe maximum number of enqueued commands.
Version
1.0
virtual CO_API co::CommandQueue::~CommandQueue ( )
virtual

Destruct a new command queue.

Version
1.0

Member Function Documentation

CO_API void co::CommandQueue::flush ( )

Flush all pending commands.

Version
1.0
CO_API size_t co::CommandQueue::getSize ( ) const
Returns
the size of the queue.
Version
1.0
CO_API bool co::CommandQueue::isEmpty ( ) const
Returns
true if the command queue is empty, false if not.
Version
1.0
virtual CO_API ICommand co::CommandQueue::pop ( const uint32_t  timeout = LB_TIMEOUT_INDEFINITE)
virtual

Pop a command from the queue.

Parameters
timeoutthe time in ms to wait for the operation.
Returns
the next command in the queue, or an invalid ICommand on timeout.
Version
1.0
virtual CO_API ICommands co::CommandQueue::popAll ( const uint32_t  timeout = LB_TIMEOUT_INDEFINITE)
virtual

Pop all, but at least one command from the queue.

Parameters
timeoutthe time in ms to wait for the operation.
Returns
All commands in the queue.
Version
1.0
virtual CO_API void co::CommandQueue::push ( const ICommand command)
virtual

Push a command to the queue.

Parameters
commandthe command.
Version
1.0
virtual CO_API void co::CommandQueue::pushFront ( const ICommand command)
virtual

Push a command to the front of the queue.

Version
1.0
virtual CO_API ICommand co::CommandQueue::tryPop ( )
virtual

Try to pop a command from the queue.

Returns
the next command in the queue, or 0 if no command is queued.
Version
1.0

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