source: pacpusframework/branches/2.0-beta1/include/Pacpus/kernel/inputOutputBase.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 1.7 KB
Line 
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
11namespace pacpus {
12
13class ComponentBase;
14
15class AbstractInterface : public QObject
16{
17 Q_OBJECT
18protected:
19 AbstractInterface(QString name, ComponentBase * component, QObject * parent = 0):_name(name),_component(component),QObject(parent) {}
20 ~AbstractInterface(){}
21public:
22 QString getSignature();
23 QString getName() {return _name;}
24 virtual QString getDataType() = 0;
25 //ComponentBase * getComponent() {return _component;}
26
27protected:
28 QString _name;
29 ComponentBase * _component;
30};
31
32class InputInterfaceBase : public AbstractInterface
33{
34 Q_OBJECT
35public:
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
43class OutputInterfaceBase: public AbstractInterface
44{
45 Q_OBJECT
46public:
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
60protected:
61 QList<ConnectionBase> _connection;
62
63};
64
65} // namespace pacpus
66
67#endif // IN_OUT_BASE_H
Note: See TracBrowser for help on using the repository browser.