-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
60 lines (40 loc) · 1.22 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <QCoreApplication>
#include <QDebug>
#include <QThreadPool>
#include <QScopedPointer>
#include <zmq.h>
#include "worker.h"
#include "writer.h"
#include "kinectcapture.h"
//#include "colorimagewriter.h"
int main(int argc, char *argv[])
{
// QCoreApplication a(argc, argv);
QScopedPointer<KinectCapture> kc(new KinectCapture);
void* ctx = zmq_ctx_new();
void* sender = zmq_socket(ctx,ZMQ_PUB);
zmq_bind(sender,"inproc://stopper");
if(!kc->Initialize())
{
qDebug()<<"Cannot Initialized Kinect";
return -1;
// QScopedPointer<Worker> sp_worker(new Worker(&kc,ctx));
}
Worker *wk = new Worker(kc.data(),ctx);
wk->setAutoDelete(true);
WriterBase *wr = new WriterBase(kc.data(),ctx);
wr->setAutoDelete(true);
//ColorImageWriter* clr_wrt = new ColorImageWriter(kc.data(),ctx);
//clr_wrt->setAutoDelete(true);
//QThreadPool::globalInstance()->start(clr_wrt);
QThreadPool::globalInstance()->start(wk);
QThreadPool::globalInstance()->start(wr);
getchar();
zmq_send(sender,"STP",3,0);
QThreadPool::globalInstance()->waitForDone();
zmq_close(sender);
zmq_ctx_term(ctx);
// delete wk;
// delete kc;
// return a.exec();
}