Collage  1.1.2
High-performance C++ library for developing object-oriented distributed applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
commandQueue.h
1 
2 /* Copyright (c) 2005-2014, 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 #include <limits.h>
27 
28 namespace co
29 {
30 namespace detail { class CommandQueue; }
31 
33 class CommandQueue : public boost::noncopyable
34 {
35 public:
42  CO_API explicit CommandQueue( const size_t maxSize = ULONG_MAX );
43 
45  CO_API virtual ~CommandQueue();
46 
53  CO_API virtual void push( const ICommand& command );
54 
56  CO_API virtual void pushFront( const ICommand& command );
57 
66  CO_API virtual ICommand pop( const uint32_t timeout =
67  LB_TIMEOUT_INDEFINITE );
68 
77  CO_API virtual ICommands popAll( const uint32_t timeout =
78  LB_TIMEOUT_INDEFINITE );
79 
86  CO_API virtual ICommand tryPop();
87 
93  CO_API bool isEmpty() const;
94 
96  CO_API void flush();
97 
99  CO_API size_t getSize() const;
100 
102  virtual void pump() {};
103 
104  LB_TS_VAR( _thread );
105 
106 private:
107  detail::CommandQueue* const _impl;
108 };
109 }
110 
111 #endif //CO_COMMANDQUEUE_H
Defines export visibility macros for Collage.
std::vector< ICommand > ICommands
A vector of input commands.
Definition: types.h:139
A thread-safe, blocking queue for ICommand buffers.
Definition: commandQueue.h:33
virtual CO_API ICommand pop(const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
Pop a command from the queue.
virtual CO_API ICommands popAll(const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
Pop all, but at least one command from the queue.
CO_API void flush()
Flush all pending commands.
A class managing received commands.
Definition: iCommand.h:43
virtual CO_API void push(const ICommand &command)
Push a command to the queue.
virtual CO_API void pushFront(const ICommand &command)
Push a command to the front of the queue.
CO_API CommandQueue(const size_t maxSize=ULONG_MAX)
Construct a new command queue.
CO_API size_t getSize() const
virtual CO_API ICommand tryPop()
Try to pop a command from the queue.
virtual CO_API ~CommandQueue()
Destruct a new command queue.
CO_API bool isEmpty() const