Bitcoin Core 29.99.0
P2P Digital Currency
type-string.h
Go to the documentation of this file.
1// Copyright (c) 2025 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef MP_PROXY_TYPE_STRING_H
6#define MP_PROXY_TYPE_STRING_H
7
8#include <mp/util.h>
9
10namespace mp {
11template <typename Value, typename Output>
14 InvokeContext& invoke_context,
15 Value&& value,
16 Output&& output)
17{
18 auto result = output.init(value.size());
19 memcpy(result.begin(), value.data(), value.size());
20}
21
22template <typename Input, typename ReadDest>
25 InvokeContext& invoke_context,
26 Input&& input,
27 ReadDest&& read_dest)
28{
29 auto data = input.get();
30 return read_dest.construct(CharCast(data.begin()), data.size());
31}
32} // namespace mp
33
34#endif // MP_PROXY_TYPE_STRING_H
Functions to serialize / deserialize common bitcoin types.
Definition: common-types.h:57
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...
Definition: common-types.h:83
char * CharCast(char *c)
Definition: util.h:213
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...
Definition: common-types.h:63
Function parameter type for prioritizing overloaded function calls that would otherwise be ambiguous.
Definition: util.h:109
Generic utility functions used by capnp code.
Definition: util.h:33