-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulation.hpp
More file actions
68 lines (60 loc) · 1.49 KB
/
Copy pathSimulation.hpp
File metadata and controls
68 lines (60 loc) · 1.49 KB
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
67
68
//
// Simulation.hpp
// MobileDetectorSim
//
// Created by Jonas Nilsson on 2016-05-11.
// Copyright © 2016 Jonas Nilsson. All rights reserved.
//
#ifndef Simulation_hpp
#define Simulation_hpp
#include <vector>
#include <boost/thread/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/random.hpp>
#include <boost/circular_buffer.hpp>
#include "ConsolePrint.hpp"
#include "Response.h"
#include "concurrent_queue.h"
struct ReturnData {
unsigned int value;
unsigned int iterations;
};
struct SimulationParams {
SimulationParams() : exit(false) {};
double distance;
double velocity;
AngularResponse angResp;
DistResponse distResp;
double activityFactor;
double background;
unsigned int critical_limit;
double startTime;
double stopTime;
double integrationTime;
unsigned int iterations;
bool exit;
concurrent_queue<ReturnData> *threadOut;
};
class SimulatorThread {
public:
SimulatorThread(int threadId, concurrent_queue<SimulationParams> *threadIn);
void operator()();
private:
concurrent_queue<SimulationParams> *threadIn;
int threadId;
};
class ListModeSimulator {
public:
ListModeSimulator(unsigned int iterations, bool use_multiple_threads);
~ListModeSimulator();
double PerformSimulation(SimulationParams params);
void CloseThreads();
private:
unsigned int iterations;
bool use_multiple_threads;
concurrent_queue<SimulationParams> threadIn;
std::vector<boost::thread> threads;
};
#endif /* Simulation_hpp */