Line data Source code
1 : #pragma once
2 :
3 : #include <pingpong/ipinger.hpp>
4 : #include <pingpong/iponger.hpp>
5 : #include <pingpong/api/ball_json.hpp>
6 : #include <wfc/jsonrpc.hpp>
7 :
8 : namespace demo{ namespace pingpong{ namespace service{
9 :
10 0 : JSONRPC_TAG(ping)
11 0 : JSONRPC_TAG(pong)
12 :
13 : template<typename Base>
14 0 : class pinger_interface: public Base
15 : {
16 : public:
17 : typedef Base super;
18 : typedef typename super::io_id_t io_id_t;
19 : typedef typename super::ball_handler ball_handler;
20 :
21 0 : virtual void pong(ball::ptr req, ball::handler cb, io_id_t, ball_handler ) override
22 : {
23 0 : this->template call<_pong_>( std::move(req), cb, nullptr);
24 0 : }
25 :
26 0 : virtual void play(ball::ptr , ball::handler cb ) override
27 : {
28 0 : if ( cb!=nullptr ) cb(nullptr);
29 0 : }
30 : };
31 :
32 0 : struct ponger_method_list: wfc::jsonrpc::method_list
33 : <
34 : wfc::jsonrpc::target<iponger>,
35 : wfc::jsonrpc::interface_<ipinger>,
36 : wfc::jsonrpc::call_method<_pong_, ball_json, ball_json>,
37 : wfc::jsonrpc::invoke_method1<
38 : _ping_,
39 : ball_json, ball_json,
40 : iponger, ipinger,
41 : &iponger::ping
42 : >
43 : >
44 : {
45 : };
46 :
47 : }}}
|