This repository was archived by the owner on Oct 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery_select.c
84 lines (64 loc) · 2.57 KB
/
query_select.c
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
#include "query_select.h"
int mainboard_select_socket(mainboard_t* elem, processor_socket_t psoc, ram_socket_t rsoc, unsigned int rsoc_count, unsigned int sd_count, unsigned int pw, unsigned int price) {
if ((psoc == PSC_ANY || mainboard_get_psoc(elem) == psoc) &&
(rsoc == RSC_ANY || mainboard_get_rsoc(elem) == rsoc) &&
(rsoc_count == 0 || mainboard_get_rsoc_count(elem) >= rsoc_count) &&
(sd_count == 0 || mainboard_get_storage_dev_count(elem) >= sd_count)) {
return 1;
}
else return 0;
}
int processor_select_socket(processor_t* elem, processor_socket_t psoc, unsigned int pw, unsigned int price) {
if (psoc == PSC_ANY || processor_get_psoc(elem) == psoc) {
return 1;
}
else return 0;
}
int ram_select_socket(ram_t* elem, ram_socket_t rsoc, unsigned int pw, unsigned int capacity, unsigned int clock_freq, unsigned int price) {
if (rsoc == RSC_ANY || ram_get_rsoc(elem) == rsoc) {
return 1;
}
else return 0;
}
int ram_select_socket_clock_freq(ram_t* elem, ram_socket_t rsoc, unsigned int pw, unsigned int capacity, unsigned int clock_freq, unsigned int price) {
if (ram_select_socket(elem, rsoc, pw, capacity, clock_freq, price) && ram_get_clock_freq(elem) == clock_freq) {
return 1;
}
else return 0;
}
int ram_select_capacity_included(ram_t* elem, ram_socket_t rsoc, unsigned int pw, unsigned int capacity, unsigned int clock_freq, unsigned int price) {
if (ram_select_socket(elem, rsoc, pw, capacity, clock_freq, price) && ram_get_capacity(elem) >= capacity) {
return 1;
}
else return 0;
}
int psu_select_pw_min(psu_t* elem, unsigned int pw, unsigned int price) {
if (psu_get_pw_output(elem) >= pw) {
return 1;
}
else return 0;
}
int storage_dev_select_pw_max(storage_dev_t* elem, unsigned int capacity, unsigned int pw, unsigned int price) {
if (storage_dev_get_power_usage(elem) <= pw) {
return 1;
}
else return 0;
}
int mainboard_select_pw_max(mainboard_t* elem, processor_socket_t psoc, ram_socket_t rsoc, unsigned int rsoc_count, unsigned int sd_count, unsigned int pw, unsigned int price) {
if (mainboard_get_power_usage(elem) <= pw) {
return 1;
}
else return 0;
}
int processor_select_pw_max(processor_t* elem, processor_socket_t psoc, unsigned int pw, unsigned int price) {
if (processor_get_power_usage(elem) <= pw) {
return 1;
}
else return 0;
}
int ram_select_pw_max(ram_t* elem, ram_socket_t rsoc, unsigned int pw, unsigned int capacity, unsigned int clock_freq, unsigned int price) {
if (ram_get_power_usage(elem) <= pw) {
return 1;
}
else return 0;
}