1 | #ifndef IN_OUT_BASE_H
|
---|
2 | #define IN_OUT_BASE_H
|
---|
3 |
|
---|
4 | #include <Pacpus/kernel/ConnectionBase.h>
|
---|
5 | #include <Pacpus/kernel/Log.h>
|
---|
6 | #include <Pacpus/kernel/pacpus.h>
|
---|
7 | #include <Pacpus/kernel/PacpusEvent.h>
|
---|
8 |
|
---|
9 | #include <QApplication>
|
---|
10 | #include <QList>
|
---|
11 | #include <QString>
|
---|
12 | #include <QStringList>
|
---|
13 | #include <typeinfo>
|
---|
14 |
|
---|
15 | namespace pacpus {
|
---|
16 |
|
---|
17 | class ComponentBase;
|
---|
18 |
|
---|
19 | class PACPUSLIB_API AbstractInterface
|
---|
20 | : public QObject
|
---|
21 | {
|
---|
22 | Q_OBJECT
|
---|
23 |
|
---|
24 | protected:
|
---|
25 | AbstractInterface(QString name, ComponentBase * component, QObject * parent = 0);
|
---|
26 | virtual ~AbstractInterface();
|
---|
27 |
|
---|
28 | public:
|
---|
29 | QString getSignature() const;
|
---|
30 | QString getName() const;
|
---|
31 | virtual QString getDataType() = 0;
|
---|
32 |
|
---|
33 | void addConnection(ConnectionBase connection);
|
---|
34 | bool removeConnection(ConnectionBase connection);
|
---|
35 | bool hasConnection();
|
---|
36 |
|
---|
37 | protected:
|
---|
38 | QList<ConnectionBase> & connections();
|
---|
39 | const QList<ConnectionBase> & getConnections() const;
|
---|
40 |
|
---|
41 | ComponentBase * component();
|
---|
42 | const ComponentBase * getComponent() const;
|
---|
43 |
|
---|
44 | private:
|
---|
45 | QString m_name;
|
---|
46 | ComponentBase * m_component;
|
---|
47 | QList<ConnectionBase> m_connections;
|
---|
48 | };
|
---|
49 |
|
---|
50 | class PACPUSLIB_API InputInterfaceBase
|
---|
51 | : public AbstractInterface
|
---|
52 | {
|
---|
53 | Q_OBJECT
|
---|
54 |
|
---|
55 | protected:
|
---|
56 | // TODO: add ctor with function pointer
|
---|
57 | InputInterfaceBase(QString name, ComponentBase * component, QObject * parent = 0);
|
---|
58 |
|
---|
59 | public:
|
---|
60 | enum ReadingMode {
|
---|
61 | NeverSkip,
|
---|
62 | TimeBounded,
|
---|
63 | GetLast
|
---|
64 | };
|
---|
65 |
|
---|
66 | virtual ~InputInterfaceBase();
|
---|
67 |
|
---|
68 | virtual void customEvent(QEvent * e);
|
---|
69 |
|
---|
70 | ReadingMode & readingMode();
|
---|
71 | const ReadingMode & getReadingMode() const;
|
---|
72 | void setReadingMode(ReadingMode mode);
|
---|
73 |
|
---|
74 | virtual PacpusEvent * getEventTemplate();
|
---|
75 |
|
---|
76 | private:
|
---|
77 | ReadingMode m_readingMode;
|
---|
78 |
|
---|
79 | // metode(QByteArray)
|
---|
80 | //QQueue jobQueue_;
|
---|
81 | };
|
---|
82 |
|
---|
83 | class PACPUSLIB_API OutputInterfaceBase
|
---|
84 | : public AbstractInterface
|
---|
85 | {
|
---|
86 | Q_OBJECT
|
---|
87 |
|
---|
88 | public:
|
---|
89 | OutputInterfaceBase(QString name, ComponentBase * component, QObject * parent = 0)
|
---|
90 | : AbstractInterface(name, component, parent)
|
---|
91 | {}
|
---|
92 |
|
---|
93 | virtual ~OutputInterfaceBase()
|
---|
94 | {}
|
---|
95 |
|
---|
96 | QStringList getInputConnectedList();
|
---|
97 |
|
---|
98 | void send(/*const*/ QByteArray & data);
|
---|
99 | };
|
---|
100 |
|
---|
101 | } // namespace pacpus
|
---|
102 |
|
---|
103 | #endif // IN_OUT_BASE_H
|
---|