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