-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulation.h
More file actions
76 lines (57 loc) · 1.7 KB
/
simulation.h
File metadata and controls
76 lines (57 loc) · 1.7 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
69
70
71
72
73
74
75
76
#ifndef SIMULATION_H
#define SIMULATION_H
#include <iostream>
#include <random>
#include <string>
#include "bookstore.h"
#include "utils.h"
#include <vector>
#include <cstdio>
#include <ctime>
#include <cstdlib>
#include <sstream>
#include "salesman.h"
#include "customer.h"
using namespace std;
// Class Simulation is responsible for running the bookstore simulation. It has private variables such as:
// - bookstore
// - customers_id
// - salesmen_id
// - customers_number
// - salesmen_number
// - time
enum operations {
buy = 1,
resign = 2,
order = 1,
continue_yes = 1,
continue_no = 0,
};
class Simulation {
public:
Simulation() = default;;
~Simulation() = default;;
// running the bookstore simulation
void run();
// loading the settings needed for the simulation
void load_data_from_files();
// loading data about (books, customers, salesmen, sections) from a file needed for simulation
void load_simulation_data(string file);
// getter of an object of the Bookstore class
const Bookstore &get_bookstore() const { return bookstore; }
unsigned int get_time() const { return time; }
void set_time(unsigned int new_time) { time = new_time; }
// determining simulation run time
void change_time(unsigned int minutes);
// random determination of the number of customers and salesmen taking part in the simulation and downloading objects to the shop from the database
void select_random_data();
private:
Bookstore bookstore;
vector<unsigned int> customers_id;
vector<unsigned int> salesmen_id;
unsigned int customers_number{};
unsigned int salesmen_number{};
unsigned int time{};
stringstream ss;
};
#endif