blob: d76c011115a4d8acfa49384609331dd85aa625d7 (
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
|
#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, mem<ITracker> t, dylibptr p, mem<IFilter> f) :
pTracker(nullptr),
pFilter(nullptr),
pProtocol(nullptr),
correct(false)
{
pTracker = t;
pProtocol = make_instance<IProtocol>(p);
pFilter = f;
if (!pTracker || !pProtocol)
{
qDebug() << "dylib load failure";
return;
}
if(!pProtocol->correct())
{
qDebug() << "protocol load failure";
return;
}
pTracker->start_tracker(frame);
correct = true;
}
|