Line data Source code
1 :
2 : /* Copyright (c) 2007-2015, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Daniel Nachbaur <danielnachbaur@gmail.com>
4 : *
5 : * This library is free software; you can redistribute it and/or modify it under
6 : * the terms of the GNU Lesser General Public License version 2.1 as published
7 : * by the Free Software Foundation.
8 : *
9 : * This library is distributed in the hope that it will be useful, but WITHOUT
10 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 : * details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public License
15 : * along with this library; if not, write to the Free Software Foundation, Inc.,
16 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 : */
18 :
19 : #ifndef EQ_COMMANDQUEUE_H
20 : #define EQ_COMMANDQUEUE_H
21 :
22 : #include <co/commandQueue.h> // base class
23 : #include <eq/types.h>
24 : #include <eq/windowSystem.h> // enum
25 :
26 : namespace eq
27 : {
28 : /**
29 : * @internal
30 : * Augments an co::CommandQueue to pump system-specific events where
31 : * required by the underlying window/operating system.
32 : */
33 : class CommandQueue : public co::CommandQueue
34 : {
35 : public:
36 : explicit CommandQueue(const size_t maxSize);
37 : virtual ~CommandQueue();
38 :
39 : /** @sa co::CommandQueue::push(). */
40 : virtual void push(const co::ICommand& command);
41 :
42 : /** @sa co::CommandQueue::pushFront(). */
43 : virtual void pushFront(const co::ICommand& command);
44 :
45 : /** @sa co::CommandQueue::pop(). */
46 : virtual co::ICommand pop(const uint32_t timeout = LB_TIMEOUT_INDEFINITE);
47 :
48 : /** @sa co::CommandQueue::popAll(). */
49 : virtual co::ICommands popAll(
50 : const uint32_t timeout = LB_TIMEOUT_INDEFINITE);
51 :
52 : /** @sa co::CommandQueue::tryPop(). */
53 : virtual co::ICommand tryPop();
54 :
55 : /** @sa reset the time spent in pop() and return the previous value. */
56 0 : int64_t resetWaitTime()
57 : {
58 0 : const int64_t time = _waitTime;
59 0 : _waitTime = 0;
60 0 : return time;
61 : }
62 :
63 8 : void setMessagePump(MessagePump* p) { _messagePump = p; }
64 12 : MessagePump* getMessagePump() { return _messagePump; }
65 : virtual void pump(); //!< @sa co::CommandQueue::pump()
66 :
67 : private:
68 : MessagePump* _messagePump;
69 :
70 : /** The time spent waiting in pop(). */
71 : int64_t _waitTime;
72 : };
73 : }
74 :
75 : #endif // EQ_COMMANDQUEUE_H
|