forked from solidoss/solidframe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipc_request_messages.hpp
76 lines (56 loc) · 1.72 KB
/
ipc_request_messages.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef TUTORIAL_IPC_REQUEST_MESSAGES_HPP
#define TUTORIAL_IPC_REQUEST_MESSAGES_HPP
#include "solid/frame/ipc/ipcmessage.hpp"
#include "solid/frame/ipc/ipccontext.hpp"
#include "solid/frame/ipc/ipcprotocol_serialization_v1.hpp"
#include <vector>
#include <map>
namespace ipc_request{
struct Request: solid::frame::ipc::Message{
std::string userid_regex;
Request(){}
Request(std::string && _ustr): userid_regex(std::move(_ustr)){}
template <class S>
void serialize(S &_s, solid::frame::ipc::ConnectionContext &_rctx){
_s.push(userid_regex, "userid_regex");
}
};
// struct Date{
//
// };
struct Date{
uint8_t day;
uint8_t month;
uint16_t year;
template <class S>
void serialize(S &_s, solid::frame::ipc::ConnectionContext &_rctx){
_s.push(day, "day").push(month, "month").push(year, "year");
}
};
struct UserData{
std::string user_id;
std::string full_name;
std::string email;
std::string country;
std::string city;
Date birth_date;
template <class S>
void serialize(S &_s, solid::frame::ipc::ConnectionContext &_rctx){
_s.push(user_id, "user_id");
_s.push(full_name, "full_name").push(email, "email");
_s.push(country, "country").push(city, "city").push(birth_date, "birth_date");
}
};
struct Response: solid::frame::ipc::Message{
using UserDataMapT = std::map<std::string, UserData>;
UserDataMapT user_data_map;
Response(){}
Response(const solid::frame::ipc::Message &_rmsg):solid::frame::ipc::Message(_rmsg){}
template <class S>
void serialize(S &_s, solid::frame::ipc::ConnectionContext &_rctx){
_s.pushContainer(user_data_map, "user_data_map");
}
};
using ProtoSpecT = solid::frame::ipc::serialization_v1::ProtoSpec<0, Request, Response>;
}//namespace ipc_request
#endif