-
Notifications
You must be signed in to change notification settings - Fork 0
/
truck.h
52 lines (46 loc) · 1.07 KB
/
truck.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
#pragma once
#include <string>
#include <ctime>
#include <limits>
struct Capacity
{
Capacity(double weight, double volume) :
weightCapacity(weight)
, volumeCapacity(volume)
{
}
double weightCapacity;
double volumeCapacity;
bool operator == (Capacity const &other) const
{
return other.weightCapacity == weightCapacity && other.volumeCapacity == volumeCapacity;
}
};
struct Truck {
public:
Truck(unsigned int curId, double wCapacity, double vCapacity, int curZone = 0, int curLoadType = 0
, std::time_t curStartTime = 9 * 60 * 60, std::time_t curFinishTime = 18 * 60 * 60,
int curMaxClients = std::numeric_limits<int>::max(), double koef = 1.0);
unsigned int id;
Capacity capacity;
std::time_t startTime;
std::time_t finishTime;
double costKoef;
int zone;
int loadType;
unsigned int maxClients;
static Truck parse(const std::string &str);
bool operator <(Truck const &truck2) const;
bool operator ==(Truck const &truck) const;
};
class TruckHash
{
public:
TruckHash()
{
}
int operator () (const Truck &truck) const
{
return truck.id;
}
};