1 | /*
|
---|
2 | * synergy -- mouse and keyboard sharing utility
|
---|
3 | * Copyright (C) 2004 Chris Schoeneman
|
---|
4 | *
|
---|
5 | * This package is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * found in the file COPYING that should have accompanied this file.
|
---|
8 | *
|
---|
9 | * This package is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | * GNU General Public License for more details.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #ifndef CSIMPLEEVENTQUEUEBUFFER_H
|
---|
16 | #define CSIMPLEEVENTQUEUEBUFFER_H
|
---|
17 |
|
---|
18 | #include "IEventQueueBuffer.h"
|
---|
19 | #include "IArchMultithread.h"
|
---|
20 | #include "stddeque.h"
|
---|
21 |
|
---|
22 | //! In-memory event queue buffer
|
---|
23 | /*!
|
---|
24 | An event queue buffer provides a queue of events for an IEventQueue.
|
---|
25 | */
|
---|
26 | class CSimpleEventQueueBuffer : public IEventQueueBuffer {
|
---|
27 | public:
|
---|
28 | CSimpleEventQueueBuffer();
|
---|
29 | ~CSimpleEventQueueBuffer();
|
---|
30 |
|
---|
31 | // IEventQueueBuffer overrides
|
---|
32 | virtual void waitForEvent(double timeout);
|
---|
33 | virtual Type getEvent(CEvent& event, UInt32& dataID);
|
---|
34 | virtual bool addEvent(UInt32 dataID);
|
---|
35 | virtual bool isEmpty() const;
|
---|
36 | virtual CEventQueueTimer*
|
---|
37 | newTimer(double duration, bool oneShot) const;
|
---|
38 | virtual void deleteTimer(CEventQueueTimer*) const;
|
---|
39 |
|
---|
40 | private:
|
---|
41 | typedef std::deque<UInt32> CEventDeque;
|
---|
42 |
|
---|
43 | CArchMutex m_queueMutex;
|
---|
44 | CArchCond m_queueReadyCond;
|
---|
45 | bool m_queueReady;
|
---|
46 | CEventDeque m_queue;
|
---|
47 | };
|
---|
48 |
|
---|
49 | #endif
|
---|