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

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

Some clean-up.

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