CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkTopicRegistry.h
Go to the documentation of this file.
1 /*
2  * ctkTopicRegistry.h
3  * ctkEventBus
4  *
5  * Created by Roberto Mucci on 26/01/11.
6  * Copyright 2011 B3C. All rights reserved.
7  *
8  * See Licence at: http://tiny.cc/QXJ4D
9  *
10  */
11 
12 #ifndef CTKTOPICREGISTRY_H
13 #define CTKTOPICREGISTRY_H
14 
15 // Includes list
16 #include "ctkEventDefinitions.h"
17 
18 namespace ctkEventBus {
19 
24 class org_commontk_eventbus_EXPORT ctkTopicRegistry {
25 public:
28 
30  void shutdown();
31 
33  bool registerTopic(const QString topic, const QObject *owner);
34 
36  bool unregisterTopic(const QString topic);
37 
39  const QObject *owner(const QString topic) const;
40 
42  bool isTopicRegistered(const QString topic) const;
43 
45  void dump();
46 
47 private:
50 
51  QHash<QString, const QObject*> m_TopicHash;
52 };
53 
54 } //nameSpace ctkEventBus
55 
56 #endif // MAFTOPICREGISTRY_H
bool registerTopic(const QString topic, const QObject *owner)
Register a new topic.
void shutdown()
Destroy the singleton instance. To be called at the end of the application.
bool isTopicRegistered(const QString topic) const
Check if a topic is present in the topic hash.
const QObject * owner(const QString topic) const
Return the owner of a topic.
void dump()
Dump of the topic hash.
bool unregisterTopic(const QString topic)
Unregister a topic.
static ctkTopicRegistry * instance()
Return an instance of the event bus.