5 #ifndef BITCOIN_IPC_CAPNP_COMMON_TYPES_H 6 #define BITCOIN_IPC_CAPNP_COMMON_TYPES_H 30 #include <type_traits> 52 concept
Deserializable = std::is_constructible_v<T, ::deserialize_type, ::DataStream&>;
62 template <
typename LocalType,
typename Value,
typename Output>
69 requires Serializable<LocalType, DataStream> && std::is_same_v<LocalType, std::remove_cv_t<std::remove_reference_t<LocalType>>>
82 template <
typename LocalType,
typename Input,
typename ReadDest>
83 decltype(
auto)
CustomReadField(TypeList<LocalType>, Priority<1>, InvokeContext& invoke_context, Input&& input, ReadDest&& read_dest)
86 return read_dest.update([&](
auto& value) {
87 if (!input.has())
return;
88 auto data = input.get();
99 template <
typename LocalType,
typename Input,
typename ReadDest>
104 auto data = input.get();
112 template <
typename Value,
typename Output>
113 void CustomBuildField(TypeList<UniValue>, Priority<1>, InvokeContext& invoke_context, Value&& value, Output&& output)
115 std::string str = value.write();
116 auto result = output.init(str.size());
120 template <
typename Input,
typename ReadDest>
122 ReadDest&& read_dest)
124 return read_dest.update([&](
auto& value) {
125 auto data = input.get();
126 value.read(std::string_view{
data.begin(),
data.size()});
132 #endif // BITCOIN_IPC_CAPNP_COMMON_TYPES_H Wrapper that overrides the GetParams() function of a stream.
Function parameter type for prioritizing overloaded function calls that would otherwise be ambiguous...
constexpr deserialize_type deserialize
#define S(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
concept Deserializable
Detect if type has a deserialize_type constructor, which is used to deserialize types like CTransacti...
memcpy(result.begin(), stream.data(), stream.size())
Generic utility functions used by capnp code.
Functions to serialize / deserialize common bitcoin types.
Minimal stream for reading from an existing byte array by std::span.
Double ended buffer combining vector and stream-like interfaces.
decltype(auto) CustomReadField(TypeList< LocalType >, Priority< 1 >, InvokeContext &invoke_context, Input &&input, ReadDest &&read_dest) requires Unserializable< LocalType
Overload multiprocess library's CustomReadField hook to allow any object with an Unserialize method t...
void CustomBuildField(TypeList< LocalType >, Priority< 1 >, InvokeContext &invoke_context, Value &&value, Output &&output) requires Serializable< LocalType
Overload multiprocess library's CustomBuildField hook to allow any serializable object to be stored i...
auto Wrap(S &s)
Construct a ParamStream wrapping a data stream with serialization parameters needed to pass transacti...
static constexpr TransactionSerParams TX_WITH_WITNESS