05Robot 3.0

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

ProcessorObject.h
Go to the documentation of this file.
1
7 #ifndef PROCESSOROBJECT_H
8 #define PROCESSOROBJECT_H
9
10 #include <QSemaphore>
11 #include <QObject>
12 #include <QString>
13 #include <QList>
14 #include <QMetaObject>
15 #include <Processor.h>
16 #include <QTime>
17
18 #include "CameraObject.h"
19 #include "cxmlio.h"
23 class CameraObject;
24
28 class ProcessorObject : public cXmlIO
29 {
30 Q_OBJECT
31
32 public:
36 QSemaphore * syncSem;
40 QSemaphore * procSem;
44 vector<CameraObject *> connectedDevices;
48 vector<ProcessorObject *> connectedProcessors;
57 ProcessorObject(Processor* p, int procType, int procId, QSemaphore *ss)
58 {
59 qRegisterMetaType<QList<ProcessorObject*>>();
60
61 proc=p;
62 processorType=procType;
63 processorID=procId;
64
65 syncSem=ss;
66 procSem = new QSemaphore();
67
68 isRunning = false;
69 }
73 ~ProcessorObject()
74 {
75 qDebug("deleting po");
76 if(isRunning)
77 proc->stop();
78 delete proc;
79 delete procSem;
80 }
81
82
83 public:
87 Processor* proc;
91 int processorType;
95 int processorID;
99 bool isRunning;
103 virtual void writeXml(QXmlStreamWriter& stream);
107 virtual void readXml(QXmlStreamReader& stream);
108
109
110 public slots:
114 void pStart();
121 void pProcess(int t1,int t2);
127 void pProcessSpecial(QString s);
128
132 void pStop();
139 void connectInputs(QList<CameraObject*> camList, QList<ProcessorObject*> procList);
146 void requestImage(void* image, void* camSem);
147
148 signals:
155 void frameOut(int id, cv::Mat* frame);
161 void writeInfo(QString);
162
163 private:
164 QMutex output_mutex_;
165
166 };
168 #endif
ProcessorObject::requestImage
void requestImage(void *image, void *camSem)
Copies first output image to requested place, releases camera semaphore.
Processor::stop
virtual int stop()
Stops image processing, should be overridden in descendant class.
cxmlio.h
ProcessorObject::~ProcessorObject
~ProcessorObject()
Default destructor, deletes corresponding Processor.
Definition: ProcessorObject.h:73
ProcessorObject::writeInfo
void writeInfo(QString)
Data logger.
ProcessorObject::pStop
void pStop()
Stops processor pipeline, sets isRunning to true.
Processor
Image processor base class.
Definition: Processor.h:28
ProcessorObject::frameOut
void frameOut(int id, cv::Mat *frame)
Emitted at finish of each frame processing.
ProcessorObject::processorID
int processorID
Processor ID, unique integer.
Definition: ProcessorObject.h:95
ProcessorObject::isRunning
bool isRunning
Running flag, true while running.
Definition: ProcessorObject.h:99
ProcessorObject::connectedDevices
vector< CameraObject * > connectedDevices
vector of pointers to cameras connected to this processor
Definition: ProcessorObject.h:44
ProcessorObject::pProcess
void pProcess(int t1, int t2)
Waits for input devices semaphore, calls process in Processor.
ProcessorObject::pStart
void pStart()
Starts processor pipeline, sets isRunning to true.
ProcessorObject::connectedProcessors
vector< ProcessorObject * > connectedProcessors
vector of pointers to processor connected to this processor
Definition: ProcessorObject.h:48
ProcessorObject
Wrapper object containing single processor, managing its processing and control pipelines, and properties.
Definition: ProcessorObject.h:28
CameraObject
Wrapper object containing single camera, managing its processing and control pipelines, and properties.
Definition: CameraObject.h:33
CameraObject.h
Processor.h
ProcessorObject::connectInputs
void connectInputs(QList< CameraObject * > camList, QList< ProcessorObject * > procList)
Sets input lists.
ProcessorObject::pProcessSpecial
void pProcessSpecial(QString s)
Calls processSpecial in Processor.
ProcessorObject::processorType
int processorType
Processor type, one of ProcessorType enum.
Definition: ProcessorObject.h:91
ProcessorObject::proc
Processor * proc
Pointer to Processor.
Definition: ProcessorObject.h:87
cXmlIO
Delivers XML file serialisation and deserialisation methods for modules.
Definition: cxmlio.h:22
ProcessorObject::ProcessorObject
ProcessorObject(Processor *p, int procType, int procId, QSemaphore *ss)
Sets processor data, creates processor semaphore.
Definition: ProcessorObject.h:57
ProcessorObject::readXml
virtual void readXml(QXmlStreamReader &stream)
Passes stream with matching class name to Processor for configuration reading.
ProcessorObject::syncSem
QSemaphore * syncSem
pointer to synchronisation semaphore shared across all processors
Definition: ProcessorObject.h:36
ProcessorObject::writeXml
virtual void writeXml(QXmlStreamWriter &stream)
Passes stream to Processor for configuration writing, encapsulates it in Processor class name...
ProcessorObject::procSem
QSemaphore * procSem
pointer to processor instance-specific semaphore
Definition: ProcessorObject.h:40