Line data Source code
1 :
2 : /* Copyright (c) 2007-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2012, 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 <eq/client/types.h>
23 : #include <eq/client/windowSystem.h> // enum
24 : #include <co/commandQueue.h> // base class
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 : 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 =
47 : LB_TIMEOUT_INDEFINITE );
48 :
49 : /** @sa co::CommandQueue::popAll(). */
50 : virtual co::ICommands popAll( const uint32_t timeout =
51 : LB_TIMEOUT_INDEFINITE );
52 :
53 : /** @sa co::CommandQueue::tryPop(). */
54 : virtual co::ICommand tryPop();
55 :
56 : /** @sa reset the time spent in pop() and return the previous value. */
57 2 : int64_t resetWaitTime()
58 2 : { const int64_t time = _waitTime; _waitTime = 0; return time; }
59 :
60 66 : void setMessagePump( MessagePump* p ) { _messagePump = p; }
61 81 : MessagePump* getMessagePump() { return _messagePump; }
62 : virtual void pump(); //!< @sa co::CommandQueue::pump()
63 :
64 : private:
65 : MessagePump* _messagePump;
66 :
67 : /** The time spent waiting in pop(). */
68 : int64_t _waitTime;
69 : };
70 : }
71 :
72 : #endif //EQ_COMMANDQUEUE_H
|