]>
vaikene.ee Git - evaf/blob - src/libs/Common/eventqueue.h
2 * @file Common/eventqueue.h
3 * @brief Event queue interface implementation
6 * Copyright (c) 2011 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
20 #ifndef __COMMON_EVENTQUEUE_H
21 #define __COMMON_EVENTQUEUE_H
23 #include "ieventqueue.h"
36 * iEventQueue interface implementation
38 class EventQueue
: public iEventQueue
46 virtual ~EventQueue();
49 virtual bool event(QEvent
* e
);
55 virtual uint
registerEvent(QString
const & name
);
57 virtual uint
queryEvent(QString
const & name
) const;
59 virtual void unregisterEvent(uint id
);
61 virtual uint
subscribeEvent(uint id
, QObject
* obj
);
63 virtual void unsubscribeEvent(uint id
, QObject
* obj
);
65 virtual void broadcastEvent(Event
* event
);
70 /// ID of the next event
73 /// List of registered events
74 typedef QHash
<uint
, QString
> Events
;
77 /// List of subscribers
78 typedef QHash
<uint
, QVector
<QObject
*> > Subscribers
;
79 Subscribers mSubscribers
;
84 /// One of the subscribers is destroyed
85 /// We need to remove it from the list of subscribers.
86 void subscriberDestroyed(QObject
* obj
= 0);
90 } // namespace evaf::Common::Internal
91 } // namespace eVaf::Common
94 #endif // eventqueue.h