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

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

Some clean-up.

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