-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputer.h
More file actions
60 lines (56 loc) · 1.52 KB
/
Copy pathComputer.h
File metadata and controls
60 lines (56 loc) · 1.52 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
#ifndef COMPUTER_H
#define COMPUTER_H
#include "string"
#include "list"
#include "UsageRecord.h"
class Location{
private:
int horizontal_row; //横排
int vertical_column; //竖列
public:
Location();
Location(int hor,int ver);
Location(const Location &other);
Location& operator=(const Location &other){
if(this!=&other){
this->horizontal_row=other.get_hor();
this->vertical_column=other.get_ver();
}
return *this;
}
int get_hor()const;
int get_ver()const;
};
enum Computer_type{
IDLE, // 空闲
IN_USE, // 使用中
MAINTENANCE, // 维护中
FAULT // 故障
};
class Computer{
private:
std::string pcid;
Location location;
Computer_type type;
std::list<UsageRecord> usagerecord;
public:
Computer();
Computer(std::string &id,int &hor,int &ver,Computer_type &types,std::list<UsageRecord> &usagerecords);
Computer(const Computer &other);
Computer& operator=(const Computer& other) {
if(this!=&other){
this->location=other.getLocation();
this->pcid=other.getPcid();
this->type=other.getComputerType();
this->usagerecord=other.getUsagerecord();
}
return *this;
}
std::string getPcid()const;
Computer_type getComputerType()const;
std::list<UsageRecord> getUsagerecord()const;
std::list<UsageRecord> &getUsagerecords();
Location getLocation()const;
void settype(Computer_type type);
};
#endif // COMPUTER_H