source: pacpusframework/branches/2.0-beta1/src/TestComponents/ShMem/ShMemInterface.h@ 96

Last change on this file since 96 was 89, checked in by morasjul, 12 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/*********************************************************************
2// created: 2007/11/13 - 10:48
3// filename: ShMemInput.h
4//
5// author: Gerald Dherbomez & Sergio Rodriguez
6// Copyright Heudiasyc UMR UTC/CNRS 6599
7//
8// version: $Id: $
9//
10// purpose: Definition of the ShMemInput class
11*********************************************************************/
12
13#ifndef SHMEM_INTERFACE_H
14#define SHMEM_INTERFACE_H
15
16#include "kernel/ComponentBase.h"
17#include <QThread>
18
19
20namespace pacpus {
21
22class ShMem;
23
24
25//class PacpusGenericEvent : QEvent
26//{
27//public:
28// PacpusGenericEvent(QEvent::Type type, char* data, size_t size):QEvent(type) {
29// _data = (char*)malloc(size);
30// memcpy(_data,data,size);
31// _size = size;}
32// virtual ~PacpusGenericEvent() { free(_data);}
33// char* _data;
34// size_t _size;
35
36//};
37
38class ShMemInput
39 : public QObject
40 , public ComponentBase
41{
42 Q_OBJECT
43
44public:
45 ShMemInput(QString name);
46 ~ShMemInput();
47
48 virtual void stopActivity();
49 virtual void startActivity();
50 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
51
52 void send(char* data, size_t size);
53 void send(const QByteArray& data);
54
55 void setDataSize(size_t size) { shMemSize_ = size;}
56
57protected:
58
59 void addInputOutput();
60
61 ShMem * shmem_,*shmemSize_;
62 QString shMemName_, shMemSizeName_;
63 size_t shMemSize_;
64
65};
66
67class ShMemOutput
68 : public QThread
69 , public ComponentBase
70{
71 Q_OBJECT
72
73public:
74 ShMemOutput(QString name);
75 ~ShMemOutput();
76
77 virtual void stopActivity(); /*!< to stop the processing thread */
78 virtual void startActivity(); /*!< to start the processing thread */
79 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
80
81
82protected:
83
84 void addInputOutput();
85
86 void run();
87
88 ShMem * shmem_,*shmemSize_;
89 QString shMemName_, shMemSizeName_;
90 size_t shMemSize_;
91 int timeout_;
92
93};
94
95} // namespace pacpus
96
97#endif // SHMEM_INTERFACE_H
Note: See TracBrowser for help on using the repository browser.