mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00

git-subtree-dir: src/ipc/libmultiprocess git-subtree-split: 35944ffd23fa26652b82210351d50e896ce16c8f
37 lines
978 B
C++
37 lines
978 B
C++
// Copyright (c) 2025 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef MP_PROXY_TYPE_CHAR_H
|
|
#define MP_PROXY_TYPE_CHAR_H
|
|
|
|
#include <mp/util.h>
|
|
|
|
namespace mp {
|
|
template <typename Output, size_t size>
|
|
void CustomBuildField(TypeList<const unsigned char*>,
|
|
Priority<3>,
|
|
InvokeContext& invoke_context,
|
|
const unsigned char (&value)[size],
|
|
Output&& output)
|
|
{
|
|
auto result = output.init(size);
|
|
memcpy(result.begin(), value, size);
|
|
}
|
|
|
|
template <size_t size, typename Input, typename ReadDest>
|
|
decltype(auto) CustomReadField(TypeList<unsigned char[size]>,
|
|
Priority<1>,
|
|
InvokeContext& invoke_context,
|
|
Input&& input,
|
|
ReadDest&& read_dest)
|
|
{
|
|
return read_dest.update([&](auto& value) {
|
|
auto data = input.get();
|
|
memcpy(value, data.begin(), size);
|
|
});
|
|
}
|
|
} // namespace mp
|
|
|
|
#endif // MP_PROXY_TYPE_CHAR_H
|