Collage  1.0.1
Object-Oriented C++ Network Library
commandQueue.h
1 
2 /* Copyright (c) 2005-2012, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This file is part of Collage <https://github.com/Eyescale/Collage>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef CO_COMMANDQUEUE_H
21 #define CO_COMMANDQUEUE_H
22 
23 #include <co/api.h>
24 #include <co/types.h>
25 #include <lunchbox/thread.h>
26 
27 namespace co
28 {
29 namespace detail { class CommandQueue; }
30 
32  class CommandQueue : public lunchbox::NonCopyable
33  {
34  public:
36  CO_API CommandQueue();
37 
39  CO_API virtual ~CommandQueue();
40 
47  CO_API virtual void push( const ICommand& command );
48 
50  CO_API virtual void pushFront( const ICommand& command );
51 
60  CO_API virtual ICommand pop( const uint32_t timeout =
61  LB_TIMEOUT_INDEFINITE );
62 
71  CO_API virtual ICommands popAll( const uint32_t timeout =
72  LB_TIMEOUT_INDEFINITE );
73 
80  CO_API virtual ICommand tryPop();
81 
87  CO_API bool isEmpty() const;
88 
90  CO_API void flush();
91 
93  CO_API size_t getSize() const;
94 
96  virtual void pump() {};
97 
98  LB_TS_VAR( _thread );
99 
100  private:
101  detail::CommandQueue* const _impl;
102  };
103 }
104 
105 #endif //CO_COMMANDQUEUE_H
virtual CO_API ~CommandQueue()
Destruct a new command queue.
CO_API void flush()
Flush all pending commands.
A class managing received commands.
Definition: iCommand.h:43
CO_API size_t getSize() const
std::vector< ICommand > ICommands
A vector of input commands.
Definition: types.h:130
virtual CO_API ICommand pop(const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
Pop a command from the queue.
virtual CO_API void push(const ICommand &command)
Push a command to the queue.
CO_API bool isEmpty() const
CO_API CommandQueue()
Construct a new command queue.
virtual CO_API ICommand tryPop()
Try to pop a command from the queue.
virtual CO_API void pushFront(const ICommand &command)
Push a command to the front of the queue.
virtual CO_API ICommands popAll(const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
Pop all, but at least one command from the queue.
A thread-safe queue for ICommand buffers.
Definition: commandQueue.h:32