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