Bitcoin Core  28.1.0
P2P Digital Currency
ipc_test.capnp.proxy.h
Go to the documentation of this file.
1 // Generated by mpgen from test/ipc_test.capnp
2 
3 #ifndef TEST_IPC_TEST_CAPNP_PROXY_H
4 #define TEST_IPC_TEST_CAPNP_PROXY_H
5 
6 #include <test/ipc_test.capnp.h>
7 #include <test/ipc_test.h>
8 #include <mp/proxy.h>
9 
10 #if defined(__GNUC__)
11 #pragma GCC diagnostic push
12 #if !defined(__has_warning)
13 #pragma GCC diagnostic ignored "-Wsuggest-override"
14 #elif __has_warning("-Wsuggest-override")
15 #pragma GCC diagnostic ignored "-Wsuggest-override"
16 #endif
17 #endif
18 namespace mp {
19 template<>
20 struct ProxyMethod<gen::FooInterface::AddParams>
21 {
22  static constexpr auto impl = &FooImplementation::add;
23 };
24 
25 template<>
26 struct ProxyMethod<gen::FooInterface::PassOutPointParams>
27 {
28  static constexpr auto impl = &FooImplementation::passOutPoint;
29 };
30 
31 template<>
32 struct ProxyMethod<gen::FooInterface::PassUniValueParams>
33 {
34  static constexpr auto impl = &FooImplementation::passUniValue;
35 };
36 
37 namespace ipc_test_fields {
38 struct A
39 {
40  template<typename S> static auto get(S&& s) -> decltype(s.getA()) { return s.getA(); }
41  template<typename S> static bool has(S&& s) { return s.hasA(); }
42  template<typename S, typename A> static void set(S&& s, A&& a) { s.setA(std::forward<A>(a)); }
43  template<typename S, typename... A> static decltype(auto) init(S&& s, A&&... a) { return s.initA(std::forward<A>(a)...); }
44  template<typename S> static bool getWant(S&& s) { return s.getWantA(); }
45  template<typename S> static void setWant(S&& s) { s.setWantA(true); }
46  template<typename S> static bool getHas(S&& s) { return s.getHasA(); }
47  template<typename S> static void setHas(S&& s) { s.setHasA(true); }
48 };
49 struct B
50 {
51  template<typename S> static auto get(S&& s) -> decltype(s.getB()) { return s.getB(); }
52  template<typename S> static bool has(S&& s) { return s.hasB(); }
53  template<typename S, typename A> static void set(S&& s, A&& a) { s.setB(std::forward<A>(a)); }
54  template<typename S, typename... A> static decltype(auto) init(S&& s, A&&... a) { return s.initB(std::forward<A>(a)...); }
55  template<typename S> static bool getWant(S&& s) { return s.getWantB(); }
56  template<typename S> static void setWant(S&& s) { s.setWantB(true); }
57  template<typename S> static bool getHas(S&& s) { return s.getHasB(); }
58  template<typename S> static void setHas(S&& s) { s.setHasB(true); }
59 };
60 struct Result
61 {
62  template<typename S> static auto get(S&& s) -> decltype(s.getResult()) { return s.getResult(); }
63  template<typename S> static bool has(S&& s) { return s.hasResult(); }
64  template<typename S, typename A> static void set(S&& s, A&& a) { s.setResult(std::forward<A>(a)); }
65  template<typename S, typename... A> static decltype(auto) init(S&& s, A&&... a) { return s.initResult(std::forward<A>(a)...); }
66  template<typename S> static bool getWant(S&& s) { return s.getWantResult(); }
67  template<typename S> static void setWant(S&& s) { s.setWantResult(true); }
68  template<typename S> static bool getHas(S&& s) { return s.getHasResult(); }
69  template<typename S> static void setHas(S&& s) { s.setHasResult(true); }
70 };
71 struct Arg
72 {
73  template<typename S> static auto get(S&& s) -> decltype(s.getArg()) { return s.getArg(); }
74  template<typename S> static bool has(S&& s) { return s.hasArg(); }
75  template<typename S, typename A> static void set(S&& s, A&& a) { s.setArg(std::forward<A>(a)); }
76  template<typename S, typename... A> static decltype(auto) init(S&& s, A&&... a) { return s.initArg(std::forward<A>(a)...); }
77  template<typename S> static bool getWant(S&& s) { return s.getWantArg(); }
78  template<typename S> static void setWant(S&& s) { s.setWantArg(true); }
79  template<typename S> static bool getHas(S&& s) { return s.getHasArg(); }
80  template<typename S> static void setHas(S&& s) { s.setHasArg(true); }
81 };
82 } // namespace ipc_test_fields
83 
84 template<>
85 struct ProxyClient<gen::FooInterface> final : public ProxyClientCustom<gen::FooInterface, FooImplementation>
86 {
87 public:
88  using ProxyClientCustom::ProxyClientCustom;
89  ~ProxyClient();
90  using M0 = ProxyClientMethodTraits<gen::FooInterface::AddParams>;
91  typename M0::Result add(M0::Param<0> a,M0::Param<1> b);
92  using M1 = ProxyClientMethodTraits<gen::FooInterface::PassOutPointParams>;
93  typename M1::Result passOutPoint(M1::Param<0> arg);
94  using M2 = ProxyClientMethodTraits<gen::FooInterface::PassUniValueParams>;
95  typename M2::Result passUniValue(M2::Param<0> arg);
96 };
97 
98 template<>
99 struct ProxyServer<gen::FooInterface> : public ProxyServerCustom<gen::FooInterface, FooImplementation>
100 {
101 public:
102  using ProxyServerCustom::ProxyServerCustom;
103  ~ProxyServer();
104  kj::Promise<void> add(AddContext call_context) override;
105  kj::Promise<void> passOutPoint(PassOutPointContext call_context) override;
106  kj::Promise<void> passUniValue(PassUniValueContext call_context) override;
107 };
108 
109 template<>
110 struct ProxyType<FooImplementation>
111 {
114  using Client = ProxyClient<Message>;
115  using Server = ProxyServer<Message>;
116 };
117 } // namespace mp
118 #if defined(__GNUC__)
119 #pragma GCC diagnostic pop
120 #endif
121 #endif
ProxyClientMethodTraits< gen::FooInterface::PassOutPointParams > M1
static void setHas(S &&s)
static void setHas(S &&s)
static bool getWant(S &&s)
#define S(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
COutPoint passOutPoint(COutPoint o)
Definition: ipc_test.h:15
Functions to serialize / deserialize common bitcoin types.
Definition: common-types.h:50
static bool getHas(S &&s)
ProxyClientMethodTraits< gen::FooInterface::AddParams > M0
UniValue passUniValue(UniValue v)
Definition: ipc_test.h:16
static void setWant(S &&s)
static bool getHas(S &&s)
static bool getWant(S &&s)
int add(int a, int b)
Definition: ipc_test.h:14
static void setWant(S &&s)
ProxyClientMethodTraits< gen::FooInterface::PassUniValueParams > M2