forked from leverich/mutilate
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOperation.h
More file actions
41 lines (32 loc) · 787 Bytes
/
Copy pathOperation.h
File metadata and controls
41 lines (32 loc) · 787 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
// -*- c++-mode -*-
#ifndef OPERATION_H
#define OPERATION_H
#include <string>
using namespace std;
class Operation {
public:
enum type_enum {
GET, GETW,
SET, SETW
};
type_enum type;
double start_time, end_time, switch_time;
uint8_t switched = 0;
uint8_t server_id = 0;
uint16_t len = 0;
double time() const { return (end_time - start_time) * 1000000; }
double switchCost() const { return (switch_time - start_time) * 1000000; }
bool operator < (const Operation& op) const {
return (start_time < op.start_time);
}
const char* toString() {
switch(type) {
case GET: return "GET";
case GETW: return "GETW";
case SET: return "SET";
case SETW: return "SETW";
default: return "?";
}
}
};
#endif // OPERATION_H