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

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

Update: fixed getDataSize(), getDataType() in connections.

  • 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 <QApplication>
10#include <QList>
11#include <QStringList>
12#include <typeinfo>
13
14namespace pacpus {
15
16class ComponentBase;
17
18class PACPUSLIB_API AbstractInterface
19 : public QObject
20{
21 Q_OBJECT
22
23protected:
24 AbstractInterface(QString name, ComponentBase * component, QObject * parent = 0);
25 virtual ~AbstractInterface();
26
27public:
28 QString getSignature() const;
29 QString getName() const;
30 virtual std::size_t getDataSize() const = 0;
31 virtual const std::type_info & getDataType() const = 0;
32
33 void addConnection(ConnectionBase connection);
34 bool removeConnection(ConnectionBase connection);
35 bool hasConnection();
36
37protected:
38 QList<ConnectionBase> & connections();
39 const QList<ConnectionBase> & getConnections() const;
40
41 ComponentBase * component();
42 const ComponentBase * getComponent() const;
43
44private:
45 QString m_name;
46 ComponentBase * m_component;
47 QList<ConnectionBase> m_connections;
48};
49
50class PACPUSLIB_API InputInterfaceBase
51 : public AbstractInterface
52{
53 Q_OBJECT
54
55protected:
56 // TODO: add ctor with function pointer
57 InputInterfaceBase(QString name, ComponentBase * component, QObject * parent = 0);
58
59public:
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 // FIXME: what's the purpose of this function?
75 virtual PacpusEvent * getEventTemplate();
76
77private:
78 ReadingMode m_readingMode;
79
80 // metode(QByteArray)
81 //QQueue jobQueue_;
82};
83
84class PACPUSLIB_API OutputInterfaceBase
85 : public AbstractInterface
86{
87 Q_OBJECT
88
89public:
90 OutputInterfaceBase(QString name, ComponentBase * component, QObject * parent = 0)
91 : AbstractInterface(name, component, parent)
92 {}
93
94 virtual ~OutputInterfaceBase()
95 {}
96
97 QStringList getInputConnectedList();
98
99 void send(/*const*/ QByteArray & data);
100};
101
102} // namespace pacpus
103
104#endif // IN_OUT_BASE_H
Note: See TracBrowser for help on using the repository browser.