-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCarCounter.h
66 lines (48 loc) · 986 Bytes
/
CarCounter.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
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
61
62
63
64
65
66
/*
* CarCounter.h
*
* Created on: 23 juil. 2017
* Author: nicolas
*/
#ifndef CARCOUNTER_H_
#define CARCOUNTER_H_
#define BUFFER_SIZE 200
#define BUFFER_DISTANCE 50
#include<chrono>
#include <iostream>
#include <fstream>
#include"Lidar.h"
using namespace std;
struct MeasuredDistance
{
chrono::high_resolution_clock::time_point captureDate;
int distance;
};
struct CarArrival
{
chrono::high_resolution_clock::time_point captureDate;
};
class CarCounter {
private:
int endOfWay;
int lastDistance;
MeasuredDistance* mesuredDistance;
int measureReadIndex;
int measureWriterIndex;
CarArrival* carArrival;
int carReadIndex;
int carWriterIndex;
bool isStarting;
public:
CarCounter();
virtual ~CarCounter();
bool hasMoreDistanceData();
bool hasMoreArrivalData();
MeasuredDistance getDistanceData();
void pushDistanceData(int distance);
CarArrival getArrivalData();
void start();
void stop();
void initEndOfWay();
};
#endif /* CARCOUNTER_H_ */