refactor IPC-dependency out of Proxy
parent
6cc64fa6a3
commit
f81ac5842c
@ -0,0 +1,38 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Простейшее type-erased значение для RPC.
|
||||||
|
// PoC: поддерживаем только int, но интерфейс позволяет в будущем
|
||||||
|
// добавить другие типы (string, bool, и т.д.).
|
||||||
|
|
||||||
|
enum class RpcType {
|
||||||
|
Int,
|
||||||
|
};
|
||||||
|
|
||||||
|
class RpcValue {
|
||||||
|
public:
|
||||||
|
RpcValue() : type_(RpcType::Int), i_(0) {}
|
||||||
|
|
||||||
|
static RpcValue fromInt(int v) {
|
||||||
|
RpcValue r;
|
||||||
|
r.type_ = RpcType::Int;
|
||||||
|
r.i_ = v;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
RpcType type() const { return type_; }
|
||||||
|
|
||||||
|
int asInt() const {
|
||||||
|
// PoC: единственный поддерживаемый тип.
|
||||||
|
return i_;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
RpcType type_;
|
||||||
|
int i_;
|
||||||
|
};
|
||||||
|
|
||||||
|
using RpcArgs = std::vector<RpcValue>;
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue