COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
WSPort.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 WSPORT_H
9 #define WSPORT_H
10 
11 #include <QObject>
12 #include <QString>
13 #include <QStringList>
14 
15 #include "WSCoviseStub.h"
16 #include "WSExport.h"
17 
18 namespace covise
19 {
20 
21 class WSLink;
22 class WSModule;
23 
24 class WSLIBEXPORT WSPort : public QObject
25 {
26 
27  Q_OBJECT
28 
29  Q_ENUMS(PortType)
30  Q_PROPERTY(QString name READ getName)
31  Q_PROPERTY(QString id READ getID)
32  Q_PROPERTY(QStringList types READ getTypes)
33  Q_PROPERTY(PortType portType READ getPortType)
34 
35 public:
36  enum PortType
37  {
40  Dependent
41  };
42 
43  WSPort(const covise::WSModule *module, const QString &name, const QStringList &acceptedTypes, PortType portType);
44  WSPort(const covise::WSModule *module, const covise::covise__Port &port);
45  virtual ~WSPort();
46 
47 public slots:
48 
52  const QString &getName() const
53  {
54  return this->portName;
55  }
56 
60  const QStringList &getTypes() const
61  {
62  return this->dataTypes;
63  }
64 
69  {
70  return this->portType;
71  }
72 
76  const covise::WSModule *getModule() const
77  {
78  return this->module;
79  }
80 
81  // void addLink(covise::WSLink * link);
82  // void removeLink(covise::WSLink * link);
83 
87  const QString &getID() const
88  {
89  return this->id;
90  }
91 
92  // signals:
93  // void linkAdded(covise::WSLink*);
94  // void linkRemoved(covise::WSLink*);
95 
96 public:
101  void setName(const QString &inName)
102  {
103  portName = inName;
104  }
105 
110  void setTypes(const QStringList &types)
111  {
112  this->dataTypes = types;
113  }
114 
119  void setPortType(PortType inPortType)
120  {
121  this->portType = inPortType;
122  }
123 
124  virtual covise::covise__Port getSerialisable() const;
125 
126  void setFromSerialisable(const covise::WSModule *module, const covise::covise__Port &serialisable);
127 
128 private:
129  // Name of the port
130  QString portName;
131  // Data types accepted or created by the port
132  QStringList dataTypes;
133  // Type of the port (default, optional, dependent)
134  PortType portType;
135 
137 
138  QString id;
139 
140  //QList<covise::WSLink*> links;
141 };
142 }
143 
144 #endif // WSPORT_H
void setTypes(const QStringList &types)
Definition: WSPort.h:110
PortType getPortType() const
Definition: WSPort.h:68
QStringList dataTypes
Definition: WSPort.h:132
GLuint const GLchar * name
Definition: khronos-glext.h:6722
#define WSLIBEXPORT
Definition: coExport.h:355
GLenum GLuint id
Definition: khronos-glext.h:6279
PortType
Definition: WSPort.h:36
void setPortType(PortType inPortType)
Definition: WSPort.h:119
const QString & getName() const
Definition: WSPort.h:52
GLsizei GLenum GLenum * types
Definition: khronos-glext.h:8471
const QString & getID() const
Definition: WSPort.h:87
Definition: WSPort.h:39
QString portName
Definition: WSPort.h:130
const QStringList & getTypes() const
Definition: WSPort.h:60
Definition: WSPort.h:24
const covise::WSModule * getModule() const
Definition: WSPort.h:76
Definition: WSModule.h:23
const covise::WSModule * module
Definition: WSPort.h:136
Definition: WSPort.h:38
void setName(const QString &inName)
Definition: WSPort.h:101