#pragma once #include #include class ProxyMarshaller { public: explicit ProxyMarshaller(IpcChannel& ch) : channel(ch) {} // Базовый type-erased вызов: принимает вектор RpcValue и возвращает RpcValue. RpcValue call(const std::string& method, const RpcArgs& args) { IpcMessage msg; // имя метода msg.add(method); // аргументы (PoC: только int) for (const auto& a : args) { msg.add(a.asInt()); } // отправить channel.send(msg); // получить ответ IpcMessage resp = channel.receive(); return RpcValue::fromInt(resp.get()); } // Удобный шаблонный хелпер для сгенерированных прокси. template Ret callTyped(const std::string& method, const Args&... args) { RpcArgs packed; packed.reserve(sizeof...(Args)); (packed.emplace_back(RpcValue::fromInt(args)), ...); // PoC: только int RpcValue r = call(method, packed); // PoC: Ret == int return static_cast(r.asInt()); } private: IpcChannel& channel; };