source: pacpusframework/trunk/include/Pacpus/kernel/InputOutputBase.h@ 282

Last change on this file since 282 was 206, checked in by Marek Kurdej, 11 years ago

Major: cleaned connection interfaces.

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