@@ -141,34 +141,6 @@ struct ReadDestUpdate
141
141
Value& m_value;
142
142
};
143
143
144
- // ProxyCallFn class is needed because c++11 doesn't support auto lambda parameters.
145
- // It's equivalent c++14: [invoke_context](auto&& params) {
146
- // invoke_context->call(std::forward<decltype(params)>(params)...)
147
- template <typename InvokeContext>
148
- struct ProxyCallFn
149
- {
150
- InvokeContext m_proxy;
151
-
152
- template <typename ... CallParams>
153
- decltype (auto ) operator ()(CallParams&&... params) { return this ->m_proxy ->call (std::forward<CallParams>(params)...); }
154
- };
155
-
156
- template <typename FnR, typename ... FnParams, typename Input, typename ReadDest>
157
- decltype (auto ) CustomReadField(TypeList<std::function<FnR(FnParams...)>>,
158
- Priority<1 >,
159
- InvokeContext& invoke_context,
160
- Input&& input,
161
- ReadDest&& read_dest)
162
- {
163
- if (input.has ()) {
164
- using Interface = typename Decay<decltype (input.get ())>::Calls;
165
- auto client = std::make_shared<ProxyClient<Interface>>(
166
- input.get (), &invoke_context.connection , /* destroy_connection= */ false );
167
- return read_dest.construct (ProxyCallFn<decltype (client)>{std::move (client)});
168
- }
169
- return read_dest.construct ();
170
- };
171
-
172
144
template <size_t index, typename LocalType, typename Input, typename Value>
173
145
void ReadOne (TypeList<LocalType> param,
174
146
InvokeContext& invoke_context,
@@ -274,32 +246,6 @@ void BuildField(TypeList<LocalTypes...>, Context& context, Output&& output, Valu
274
246
}
275
247
}
276
248
277
- // ! Adapter to convert ProxyCallback object call to function object call.
278
- template <typename Result, typename ... Args>
279
- class ProxyCallbackImpl final : public ProxyCallback<std::function<Result(Args...)>>
280
- {
281
- using Fn = std::function<Result(Args...)>;
282
- Fn m_fn;
283
-
284
- public:
285
- ProxyCallbackImpl (Fn fn) : m_fn(std::move(fn)) {}
286
- Result call (Args&&... args) override { return m_fn (std::forward<Args>(args)...); }
287
- };
288
-
289
- template <typename Value, typename FnR, typename ... FnParams, typename Output>
290
- void CustomBuildField (TypeList<std::function<FnR(FnParams...)>>,
291
- Priority<1>,
292
- InvokeContext& invoke_context,
293
- Value& value,
294
- Output&& output)
295
- {
296
- if (value) {
297
- using Interface = typename decltype (output.get ())::Calls;
298
- using Callback = ProxyCallbackImpl<FnR, FnParams...>;
299
- output.set (kj::heap<ProxyServer<Interface>>(
300
- std::make_shared<Callback>(std::forward<Value>(value)), invoke_context.connection ));
301
- }
302
- }
303
249
// Adapter to let BuildField overloads methods work set & init list elements as
304
250
// if they were fields of a struct. If BuildField is changed to use some kind of
305
251
// accessor class instead of calling method pointers, then then maybe this could
0 commit comments