blob: 7617ce90a8db9fa5b8210fd05ae5de38a4d5548b (
plain)
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
|
#include "opentrack/selected-libraries.hpp"
#include <QDebug>
SelectedLibraries::~SelectedLibraries()
{
}
template<typename t>
static mem<t> make_instance(mem<dylib> lib)
{
mem<t> ret;
if (lib != nullptr && lib->Constructor)
ret = mem<t>(reinterpret_cast<t*>(reinterpret_cast<OPENTRACK_CTOR_FUNPTR>(lib->Constructor)()));
return ret;
}
SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) :
pTracker(nullptr),
pFilter(nullptr),
pProtocol(nullptr),
correct(false)
{
pProtocol = make_instance<IProtocol>(p);
if (!pProtocol)
{
qDebug() << "protocol dylib load failure";
return;
}
if(!pProtocol->correct())
{
qDebug() << "protocol load failure";
pProtocol = nullptr;
return;
}
pTracker = make_instance<ITracker>(t);
pFilter = make_instance<IFilter>(f);
if (!pTracker)
{
qDebug() << "tracker dylib load failure";
return;
}
pTracker->start_tracker(frame);
correct = true;
}
|