-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbwriter.h
35 lines (31 loc) · 1.03 KB
/
dbwriter.h
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
#ifndef DBWRITER_H
#define DBWRITER_H
#include <QObject>
#include <QRunnable>
#include <packet.h>
#include <device.h>
#include <memory>
#include <mutex>
#include <QMap>
#include <globalstate.h>
#include <qdb.h>
#include <math.h>
class DBWriter: public QObject, public QRunnable
{
Q_OBJECT
using timeDuration=std::chrono::duration<qulonglong, std::ratio<1>>;
using timeTimePoint= std::chrono::time_point<std::chrono::system_clock, timeDuration>;
public:
DBWriter(QMap<uint64_t, Device>& devices, QMap<uint64_t, timeTimePoint>& knownFake, qulonglong time);
signals:
void databaseUpdated(qulonglong time);
protected:
void run();
private:
std::pair<double, double> intersectionFinder(double x1, double b_y1, double r1, double x2, double y2,double r2, double x3, double y3, double r3);
std::pair<double,double> minMax(std::vector<double>& x, std::vector<double>& y, std::vector<double>& r);
QMap<uint64_t, Device> & devices;
QMap<uint64_t, timeTimePoint> & fakes;
timeTimePoint time;
};
#endif // DBWRITER_H