COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
WSCOVISEClient.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 WSCOVISECLIENT_H
9 #define WSCOVISECLIENT_H
10 
11 #include <QList>
12 #include <QMap>
13 #include <QMutex>
14 #include <QObject>
15 #include <QQueue>
16 #include <QString>
17 #include <QStringList>
18 #include <QThread>
19 
20 #include "WSExport.h"
21 
22 namespace covise
23 {
24 
25 class WSMap;
26 class WSModule;
27 class WSParameter;
28 class covise__Event;
29 
30 class COVISEProxy;
31 
32 class WSLIBEXPORT WSCOVISEClient : public QThread
33 {
34 
35  Q_OBJECT
36  Q_DISABLE_COPY(WSCOVISEClient)
37 
38  Q_PROPERTY(WSMap *map READ getMap)
39  Q_PROPERTY(QString endpoint READ getEndpoint)
40  Q_PROPERTY(bool inExecute READ isInExecute)
41 
42 public:
44  virtual ~WSCOVISEClient();
45 
46 public slots:
48  bool attach(const QString &endpoint = "http://localhost:31111/");
49 
51  bool detach();
52 
53  const QString &getEndpoint() const
54  {
55  return this->endpoint;
56  }
57 
58  bool isInExecute() const;
59 
61  void setEventsAsSignal(bool on, bool alsoQueueRaw = false);
62 
64  void setReadOnly(bool ro);
65  bool isReadOnly() const;
66 
68  WSMap *getMap() const;
69 
71  WSModule *getModule(const QString &name, const QString &host) const;
72 
74  QList<WSModule *> getModules(const QString &host) const;
75 
77  QStringList getHosts() const;
78 
80  void executeNet();
81 
83  void executeModule(const QString &moduleID);
84 
86  void setParameterFromString(const QString &moduleID, const QString &parameter, const QString &value);
87 
89  QString getParameterAsString(const QString &moduleID, const QString &parameter);
90 
92  void instantiateModule(const QString &module, const QString &host);
93 
95  void deleteModule(const QString &moduleID);
96 
97  void link(const QString &fromModuleID, const QString &fromPort, const QString &toModuleID, const QString &toPort);
98  void unlink(const QString &linkID);
99 
101  void openNet(const QString &filename);
102 
104  void quit();
105 
107  covise::covise__Event *takeEvent();
108 
109 signals:
110  void eventLink(const QString &fromModuleID, const QString &toModuleID);
111  void eventUnlink(const QString &linkID);
112  void eventModuleAdd(const QString &moduleID);
113  void eventModuleDel(const QString &moduleID);
114  void eventModuleDied(const QString &moduleID);
115  void eventModuleChanged(const QString &moduleID);
116  void eventModuleExecuteStart(const QString &moduleID);
117  void eventModuleExecuteFinish(const QString &moduleID);
118  void eventExecuteStart();
119  void eventExecuteFinish();
120 
121  void eventParameterChanged(const QString &moduleID, const QString &name, const QString &value);
122  void eventOpenNet(const QString &mapname);
123  void eventOpenNetDone(const QString &mapname);
124  void eventQuit();
125 
126 private slots:
127  void parameterChangeCB(covise::WSParameter *);
128 
129 private:
130  void clearAvailableModules();
131 
132  virtual void run();
133 
134  // Contains a map of the host and the modules available on that host
135  QMap<QString, QList<covise::WSModule *> > availableModules;
136  // The loaded modules
138 
139  QString endpoint;
140  bool attached;
141 
143 
144  QString eventUUID;
145 
146  QQueue<covise::covise__Event *> eventQueue;
148 
151 
152  bool readOnly;
153  bool inExecute;
154 };
155 }
156 
157 #endif // WSCOVISECLIENT_H
QMap< QString, QList< covise::WSModule * > > availableModules
Definition: WSCOVISEClient.h:135
Definition: WSMap.h:21
bool readOnly
Definition: WSCOVISEClient.h:152
QString eventUUID
Definition: WSCOVISEClient.h:144
Definition: WSCOVISEClient.h:32
bool eventsAsSignal
Definition: WSCOVISEClient.h:149
GLuint const GLchar * name
Definition: khronos-glext.h:6722
bool keepRunning
Definition: WSCOVISEClient.h:142
covise::WSMap * map
Definition: WSCOVISEClient.h:137
bool attached
Definition: WSCOVISEClient.h:140
Definition: WSParameter.h:27
QMutex eventQueueLock
Definition: WSCOVISEClient.h:147
QQueue< covise::covise__Event * > eventQueue
Definition: WSCOVISEClient.h:146
GLsizei const GLfloat * value
Definition: khronos-glext.h:6760
Definition: WSModule.h:23
#define WSLIBEXPORT
Definition: coExport.h:373
bool alsoQueueRaw
Definition: WSCOVISEClient.h:150