forked from jackburton79/ocs-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Machine.h
157 lines (125 loc) · 2.97 KB
/
Machine.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
* Machine.h
*
* Created on: 11/lug/2013
* Author: Stefano Ceccherini
*/
#ifndef MACHINE_H_
#define MACHINE_H_
#include <map>
#include <string>
#include <vector>
typedef std::map<int, std::map<std::string, std::string> > dmi_db;
struct bios_info {
std::string vendor;
std::string release_date;
std::string version;
void MergeWith(const bios_info& info);
int Score() const;
};
struct system_info {
std::string name;
std::string vendor;
std::string serial;
std::string version;
std::string uuid;
void MergeWith(const system_info& info);
int Score() const;
};
struct board_info {
std::string asset_tag;
std::string name;
std::string serial;
std::string vendor;
std::string version;
void MergeWith(const board_info& info);
int Score() const;
};
struct chassis_info {
std::string asset_tag;
std::string serial;
std::string type;
std::string vendor;
std::string version;
void MergeWith(const chassis_info& info);
int Score() const;
};
struct video_info {
std::string vendor;
std::string chipset;
std::string memory;
std::string name;
std::string resolution;
void MergeWith(const video_info& info);
};
struct memory_device_info {
memory_device_info();
std::string Type() const;
std::string Speed() const;
std::string Size() const;
std::string description;
std::string caption;
std::string purpose;
std::string type;
std::string vendor;
std::string serial;
std::string asset_tag;
unsigned int speed;
unsigned int size;
};
class OSInfo {
public:
OSInfo();
std::string description;
std::string release;
std::string hostname;
std::string domainname;
std::string architecture;
std::string memory;
std::string swap;
std::string comments;
private:
std::string _OSDescription();
};
class Machine {
public:
static Machine* Get();
std::string AssetTag() const;
std::string BIOSManufacturer() const;
std::string BIOSDate() const;
std::string BIOSVersion() const;
std::string MachineManufacturer() const;
std::string MachineSerialNumber() const;
std::string SystemModel() const;
std::string SystemSerialNumber() const;
std::string SystemUUID() const;
std::string SystemManufacturer() const;
std::string SystemType() const;
int CountMemories();
std::string MemoryCaption(int num);
std::string MemoryDescription(int num);
std::string MemoryCapacity(int num);
std::string MemoryPurpose(int num);
std::string MemoryType(int num);
std::string MemorySpeed(int num);
std::string MemoryNumSlot(int num);
std::string MemorySerialNumber(int num);
int CountVideos() const;
video_info VideoInfoFor(int numVideo) const;
private:
Machine();
~Machine();
void _RetrieveData();
bool _GetDMIData();
bool _GetGraphicsCardInfo();
bool _GetDMIDecodeData();
bool _GetLSHWData();
void _ExtractDataFromDMIDB(dmi_db dmiDb);
std::vector<memory_device_info> fMemoryInfo;
bios_info fBIOSInfo;
chassis_info fChassisInfo;
board_info fBoardInfo;
system_info fSystemInfo;
std::vector<struct video_info> fVideoInfo;
};
#endif /* MACHINE_H_ */