1 | #ifndef IN_OUT_BASE_H
|
---|
2 | #define IN_OUT_BASE_H
|
---|
3 |
|
---|
4 | #include <Pacpus/kernel/ConnectionBase.h>
|
---|
5 |
|
---|
6 | #include <typeinfo>
|
---|
7 | #include <QEvent>
|
---|
8 | #include <QList>
|
---|
9 | #include <QStringList>
|
---|
10 |
|
---|
11 | namespace pacpus {
|
---|
12 |
|
---|
13 | class ComponentBase;
|
---|
14 |
|
---|
15 | class AbstractInterface : public QObject
|
---|
16 | {
|
---|
17 | Q_OBJECT
|
---|
18 | protected:
|
---|
19 | AbstractInterface(QString name, ComponentBase * component, QObject * parent = 0):_name(name),_component(component),QObject(parent) {}
|
---|
20 | ~AbstractInterface(){}
|
---|
21 | public:
|
---|
22 | QString getSignature();
|
---|
23 | QString getName() {return _name;}
|
---|
24 | virtual QString getDataType() = 0;
|
---|
25 | //ComponentBase * getComponent() {return _component;}
|
---|
26 |
|
---|
27 | protected:
|
---|
28 | QString _name;
|
---|
29 | ComponentBase * _component;
|
---|
30 | };
|
---|
31 |
|
---|
32 | class InputInterfaceBase : public AbstractInterface
|
---|
33 | {
|
---|
34 | Q_OBJECT
|
---|
35 | public:
|
---|
36 | InputInterfaceBase(QString name, ComponentBase * component, QObject * parent = 0):AbstractInterface(name,component,parent) {}
|
---|
37 | virtual ~InputInterfaceBase(){}
|
---|
38 |
|
---|
39 | virtual void customEvent(QEvent* e) = 0;
|
---|
40 |
|
---|
41 | };
|
---|
42 |
|
---|
43 | class OutputInterfaceBase: public AbstractInterface
|
---|
44 | {
|
---|
45 | Q_OBJECT
|
---|
46 | public:
|
---|
47 | OutputInterfaceBase(QString name, ComponentBase * component, QObject * parent = 0):AbstractInterface(name,component,parent) {}
|
---|
48 | virtual ~OutputInterfaceBase(){}
|
---|
49 |
|
---|
50 | void addConnection(ConnectionBase connection) { _connection.append(connection);}
|
---|
51 | bool removeConnection(ConnectionBase connection) { return _connection.removeOne(connection);}
|
---|
52 |
|
---|
53 | QStringList getInputConnectedList() {
|
---|
54 | QStringList list;
|
---|
55 | for(QList<ConnectionBase>::iterator it = _connection.begin(); it!=_connection.end(); ++it)
|
---|
56 | list.append(it->getInputInterface()->getName());
|
---|
57 | return list;
|
---|
58 | }
|
---|
59 |
|
---|
60 | protected:
|
---|
61 | QList<ConnectionBase> _connection;
|
---|
62 |
|
---|
63 | };
|
---|
64 |
|
---|
65 | } // namespace pacpus
|
---|
66 |
|
---|
67 | #endif // IN_OUT_BASE_H
|
---|