-
Notifications
You must be signed in to change notification settings - Fork 1
/
Request.hpp
58 lines (45 loc) · 1.11 KB
/
Request.hpp
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
#ifndef HLCUP_REQUEST_HPP__
#define HLCUP_REQUEST_HPP__
#include <bitset>
#include "common.hpp"
namespace hlcup {
struct Request {
std::bitset<8> mask;
typedef int32_t time_t;
enum Param { kFromDate = 0, kToDate, kFromAge, kToAge, kCountry, kToDistance, kGender };
enum Action {
kNotFound = 0,
kBadRequest,
kGetIndex,
kGetUser,
kGetLocation,
kGetVisit,
kGetUserVisits,
kGetLocationAvg,
kPostUser,
kPostUserNew,
kPostLocation,
kPostLocationNew,
kPostVisit,
kPostVisitNew
};
static const Action kGetLast = kGetLocationAvg;
Action action = Action::kNotFound;
int32_t entity_id = Entity::kInvalidId;
time_t from_date = 0, to_date = 0;
int32_t from_age, to_age;
std::string country;
int32_t to_distance;
Gender gender;
User u;
Location l;
Visit v;
void reset() {
mask.reset();
action = Action::kNotFound;
entity_id = Entity::kInvalidId;
}
bool isSet(Param p) { return mask.test(static_cast<size_t>(p)); }
};
}
#endif