Collage  1.7.0
High-performance C++ library for developing object-oriented distributed applications.
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 <limits.h>
26 #include <lunchbox/thread.h>
27 
28 namespace co
29 {
30 namespace detail
31 {
32 class CommandQueue;
33 }
34 
36 class CommandQueue : public boost::noncopyable
37 {
38 public:
45  CO_API explicit CommandQueue(const size_t maxSize = ULONG_MAX);
46 
48  CO_API virtual ~CommandQueue();
49 
56  CO_API virtual void push(const ICommand& command);
57 
59  CO_API virtual void pushFront(const ICommand& command);
60 
68  CO_API virtual ICommand pop(const uint32_t timeout = LB_TIMEOUT_INDEFINITE);
69 
77  CO_API virtual ICommands popAll(
78  const uint32_t timeout = 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 library Collage.
A thread-safe, blocking queue for ICommand buffers.
Definition: commandQueue.h:36
Object-oriented network library.
Definition: barrier.h:27
A class managing received commands.
Definition: iCommand.h:45
std::vector< ICommand > ICommands
A vector of input commands.
Definition: types.h:138