COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
WSMap.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef WSMAP_H
9 #define WSMAP_H
10 
11 #include "WSExport.h"
12 #include "WSModule.h"
13 
14 #include <QObject>
15 
16 namespace covise
17 {
18 
19 class WSLink;
20 
21 class WSLIBEXPORT WSMap : public QObject
22 {
23 
24  Q_OBJECT
25 
26  Q_PROPERTY(QString mapname READ getMapName WRITE setMapName)
27 
28  Q_DISABLE_COPY(WSMap)
29 
30 public:
31  WSMap();
32  virtual ~WSMap();
33 
42  WSModule *addModule(const WSModule *module, const QString &instance, const QString &host);
43 
50  WSModule *addModule(const WSModule *module);
51 
58  WSModule *addModule(const covise::covise__Module &module);
59 
65  const QString &removeModule(const QString &moduleID);
66 
72  WSModule *takeModule(const QString &moduleID);
73 
74 public slots:
75 
84  WSLink *link(const QString &fromModule, const QString &fromPort, const QString &toModule, const QString &toPort);
85  bool unlink(const QString &fromModule, const QString &fromPort, const QString &toModule, const QString &toPort);
86  bool unlink(WSLink *link);
87  bool unlink(const QString &linkID);
88 
89  WSLink *getLink(const QString &linkID) const;
90  QList<WSLink *> getLinks() const;
91 
98  WSModule *getModule(const QString &name, const QString &instance, const QString &host) const;
99 
104  WSModule *getModule(const QString &moduleID) const;
105 
112  WSModule *getModuleByTitle(const QString &title) const;
113 
117  QList<WSModule *> getModules() const;
118 
123  void setMapName(const QString &name);
124 
129  const QString &getMapName() const
130  {
131  return this->mapName;
132  }
133 
140  static QString makeKeyName(const QString &name, const QString &instance, const QString &host);
141 
142 signals:
143  void moduleAdded(WSModule *module);
144  void moduleRemoved(const QString &moduleID);
145 
146 private:
147  // The running modules
148  QMap<QString, WSModule *> runningModules;
149 
150  // The name of the map
151  QString mapName;
152 
153  QMap<QString, covise::WSLink *> links;
154 
159  void setRunningModules(const QMap<QString, WSModule *> &modules)
160  {
161  runningModules = modules;
162  }
163 
168  void printList(const QMap<QString, WSModule *> &map);
169 
170 private slots:
171  void linkDestroyed(const QString &linkID);
172 };
173 }
174 #endif // WSMAP_H
QMap< QString, WSModule * > runningModules
Definition: WSMap.h:148
void setRunningModules(const QMap< QString, WSModule * > &modules)
Definition: WSMap.h:159
Definition: WSMap.h:21
Definition: WSLink.h:21
GLuint const GLchar * name
Definition: khronos-glext.h:6722
QMap< QString, covise::WSLink * > links
Definition: WSMap.h:153
QString mapName
Definition: WSMap.h:151
Definition: WSModule.h:23
#define WSLIBEXPORT
Definition: coExport.h:373