2
3
6
7
8
9
10
14#include <restinio/request_handler.hpp>
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
178 store_to( std::size_t index, Head && head, Tail && ...tail )
181 [handler = std::move(head)]
184 return handler( req );
187 if constexpr( 0u !=
sizeof...(tail) )
188 store_to( index + 1u, std::forward<Tail>(tail)... );
193
194
195
196
197
201
202
203
204
205
206
207 template<
typename... Handlers >
210 static_assert( Size ==
sizeof...(handlers),
211 "Wrong number of parameters for the constructor of "
212 "fixed_size_chain_t<Size>. Exact `Size` parameters expected" );
214 store_to( 0u, std::forward<Handlers>(handlers)... );
219 operator()(
const actual_request_handle_t & req )
const
A holder of fixed-size chain of synchronous handlers.
std::array< handler_holder_t, Size > m_handlers
void store_to(std::size_t index, Head &&head, Tail &&...tail)
fixed_size_chain_t()=delete
fixed_size_chain_t(Handlers &&...handlers)
Initializing constructor.
std::function< request_handling_status_t(const actual_request_handle_t &) > handler_holder_t
request_handling_status_t operator()(const actual_request_handle_t &req) const
constexpr request_handling_status_t request_not_handled() noexcept
request_handling_status_t
Request handling status.
@ accepted
Request accepted for handling.
@ not_handled
The request wasn't handled. If there is another handler to be tried it should be tried....
@ rejected
Request wasn't accepted for handling.