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