-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.h
More file actions
43 lines (38 loc) · 711 Bytes
/
data.h
File metadata and controls
43 lines (38 loc) · 711 Bytes
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
struct ResourceTuple
{
int id;
int timestamp;
int resources;
int nodeId;
};
struct JobTuple
{
int id;
int timestamp;
int resources;
int duration;
};
inline std::istream& operator>>(std::istream& i, ResourceTuple& r)
{
return i >> r.timestamp >> r.resources >> r.nodeId;
}
inline std::istream& operator>>(std::istream& i, JobTuple& j)
{
return i >> j.timestamp >> j.resources >> j.duration;
}
template<typename T>
void readFile(const char* fname, std::queue<T>& q)
{
LOG("loading file: " << fname);
std::ifstream ifs(fname);
VERIFY(ifs, "cannot open file");
T t;
int count = 0;
while (ifs >> t)
{
++ count;
t.id = count;
q.emplace(std::move(t));
}
LOG("loaded items: " << count);
}