You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
618 B
C++

#pragma once
#include <ipc/IpcChannel.h>
class ProxyMarshaller {
public:
explicit ProxyMarshaller(IpcChannel& ch) : channel(ch) {}
template<typename Ret, typename... Args>
Ret call(const std::string& method, const Args&... args) {
IpcMessage msg;
// имя метода
msg.add(method);
// аргументы
(msg.add(args), ...);
// отправить
channel.send(msg);
// получить ответ
IpcMessage resp = channel.receive();
return resp.template get<Ret>();
}
private:
IpcChannel& channel;
};