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.c
77 lines (57 loc) · 1.92 KB
/
query.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
#include "query.h"
/* query_result_t pass edilen init edilmis bir obje olmali, ve mumkunse bos yolla ki, farkli turler karismasin - SS */
void mainboard_query(query_result_t* res, mainboard_block_t* block, mainboard_query_cb_t query,
processor_socket_t psoc, ram_socket_t rsoc, unsigned int rsoc_count, unsigned int sd_count, unsigned int pw, unsigned int price) {
int i;
mainboard_t* mb;
for (i = 0; i < block->count; ++i) {
mb = block->data[i];
if (query(mb, psoc, rsoc, rsoc_count, sd_count, pw, price)) {
res->elems[res->count++] = mb;
}
}
}
void processor_query(query_result_t* res, processor_block_t* block, processor_query_cb_t query,
processor_socket_t psoc, unsigned int pw, unsigned int price) {
int i;
processor_t* p;
for (i = 0; i < block->count; ++i) {
p = block->data[i];
if (query(p, psoc, pw, price)) {
res->elems[res->count++] = p;
}
}
}
void ram_query(query_result_t* res, ram_block_t* block, ram_query_cb_t query,
ram_socket_t rsoc, unsigned int pw, unsigned int capacity, unsigned int clock_freq, unsigned int price) {
int i;
ram_t* ram;
for (i = 0; i < block->count; ++i) {
ram = block->data[i];
if (query(ram, rsoc, pw, capacity, clock_freq, price)) {
res->elems[res->count++] = ram;
}
}
}
void psu_query(query_result_t* res, psu_block_t* block, psu_query_cb_t query,
unsigned int pw, unsigned int price) {
int i;
psu_t* psu;
for (i = 0; i < block->count; ++i) {
psu = block->data[i];
if (query(psu, pw, price)) {
res->elems[res->count++] = psu;
}
}
}
void storage_dev_query(query_result_t* res, storage_dev_block_t* block, storage_dev_query_cb_t query,
unsigned int capacity, unsigned int pw, unsigned int price) {
int i;
storage_dev_t* sd;
for (i = 0; i < block->count; ++i) {
sd = block->data[i];
if (query(sd, capacity, pw, price)) {
res->elems[res->count++] = sd;
}
}
}