5 #ifndef BITCOIN_IPC_CAPNP_COMMON_TYPES_H 6 #define BITCOIN_IPC_CAPNP_COMMON_TYPES_H 16 #include <mp/proxy-types.h> 17 #include <mp/type-chrono.h> 18 #include <mp/type-context.h> 19 #include <mp/type-data.h> 20 #include <mp/type-decay.h> 21 #include <mp/type-interface.h> 22 #include <mp/type-message.h> 23 #include <mp/type-number.h> 24 #include <mp/type-optional.h> 25 #include <mp/type-pointer.h> 26 #include <mp/type-string.h> 27 #include <mp/type-struct.h> 28 #include <mp/type-threadmap.h> 29 #include <mp/type-vector.h> 30 #include <type_traits> 52 concept
Deserializable = std::is_constructible_v<T, ::deserialize_type, ::DataStream&>;
62 template <
typename LocalType,
typename Value,
typename Output>
63 void CustomBuildField(TypeList<LocalType>, Priority<1>, InvokeContext& invoke_context, Value&& value, Output&& 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>
100 decltype(
auto)
CustomReadField(TypeList<LocalType>, Priority<1>, InvokeContext& invoke_context, Input&& input, ReadDest&& read_dest)
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.
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())
Functions to serialize / deserialize common bitcoin types.
Minimal stream for reading from an existing byte array by 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