-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulator.h
44 lines (37 loc) · 981 Bytes
/
simulator.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
#ifndef SIMULATOR_H_
#define SIMULATOR_H_
#include "parqueue.h"
#include <array>
#include "task.h"
#include "counter.h"
#include <cstddef>
#include <thread>
#include "logger.h"
#include"ticket.h"
namespace accent{
class Simulator {
public:
Simulator();
~Simulator();
void run();
protected:
void triggerAticket();
void triggerClose() noexcept;
void SimulatorArrival()noexcept;
void updateLogger();
void setLogger();
private:
using DataType = Ticket;
using parQueueType = tempDS::parQueue<DataType>;
static constexpr std::size_t COUNTERCOUNT=3;
std::array<parQueueType,std::size(accent::Task::TaskTypes)>m_Queues;
//std::array<accent::Counter<DataType>,COUNTERCOUNT> m_Counters;
accent::Counter<DataType> m_Counters[COUNTERCOUNT];
static std::size_t ticketsCounter;
std::thread m_CustomerThread;
std::array<std::thread,Simulator::COUNTERCOUNT> m_CounterThreads;
std::thread m_CustomerCloseThread;
accentlog::CLogger m_logger;
};
}
#endif /* SIMULATOR_H_ */