remove Impl from proxy

master
Сергей Маринкевич 2 months ago
parent 9f48a74677
commit 40170d553d

@ -20,6 +20,6 @@ int main() {
ProxyMarshaller marshaller(ch); ProxyMarshaller marshaller(ch);
MyServiceProxy proxy(marshaller); MyServiceProxy proxy(marshaller);
int r = proxy.add(7, 8); int r = proxy.add(7, 9);
std::cout << "RESULT: " << r << std::endl; std::cout << "RESULT: " << r << std::endl;
} }

@ -1,19 +1,11 @@
#include "{{ cls.name }}.proxy.h" #include "{{ cls.name }}.proxy.h"
class {{ cls.name }}Proxy::Impl {
public:
explicit Impl(ProxyMarshaller& m)
: client(m) {}
ProxyMarshaller& client;
};
{{ cls.name }}Proxy::{{ cls.name }}Proxy(ProxyMarshaller& marshaller) {{ cls.name }}Proxy::{{ cls.name }}Proxy(ProxyMarshaller& marshaller)
: impl(new Impl(marshaller)) {} : impl(marshaller) {}
{% for m in cls.methods %} {% for m in cls.methods %}
{{ m.return_type }} {{ cls.name }}Proxy::{{ m.name }}({% for a in m.args %}{{ a.type }} {{ a.name }}{% if not loop.last %}, {% endif %}{% endfor %}) { {{ m.return_type }} {{ cls.name }}Proxy::{{ m.name }}({% for a in m.args %}{{ a.type }} {{ a.name }}{% if not loop.last %}, {% endif %}{% endfor %}) {
return impl->client.call<{{ m.return_type }}>("{{ cls.name }}.{{ m.name }}"{% for a in m.args %}, {{ a.name }}{% endfor %}); return impl.call<{{ m.return_type }}>("{{ cls.name }}.{{ m.name }}"{% for a in m.args %}, {{ a.name }}{% endfor %});
} }
{% endfor %} {% endfor %}

@ -10,6 +10,5 @@ public:
{% endfor %} {% endfor %}
private: private:
class Impl; ProxyMarshaller& impl;
Impl* impl;
}; };

Loading…
Cancel
Save