Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
type-vector.h
Go to the documentation of this file.
1// Copyright (c) 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_VECTOR_H
6#define MP_PROXY_TYPE_VECTOR_H
7
8#include <mp/proxy-types.h>
9#include <mp/util.h>
10
11namespace mp {
12template <typename LocalType, typename Value, typename Output>
13void CustomBuildField(TypeList<std::vector<LocalType>>,
16 Value&& value,
17 Output&& output)
18{
20}
21
22inline static bool BuildPrimitive(InvokeContext& invoke_context, std::vector<bool>::const_reference value, TypeList<bool>)
23{
24 return value;
25}
26
27template <typename LocalType, typename Input, typename ReadDest>
28decltype(auto) CustomReadField(TypeList<std::vector<LocalType>>,
31 Input&& input,
33{
34 return ReadList(
36 [&](auto& value, size_t size) {
37 value.clear();
38 value.reserve(size);
39 },
40 [&](auto& value, auto&&... args) -> decltype(auto) {
41 value.emplace_back(std::forward<decltype(args)>(args)...);
42 return value.back();
43 });
44}
45} // namespace mp
46
47#endif // MP_PROXY_TYPE_VECTOR_H
ArgsManager & args
Definition bitcoind.cpp:280
Functions to serialize / deserialize common bitcoin types.
void BuildList(TypeList< LocalType >, InvokeContext &invoke_context, Output &&output, Value &&value)
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...
LocalType BuildPrimitive(InvokeContext &invoke_context, const Value &value, TypeList< LocalType >, typename std::enable_if< std::is_enum< Value >::value >::type *enable=nullptr)
Definition type-number.h:12
decltype(auto) ReadList(TypeList< LocalType >, InvokeContext &invoke_context, Input &&input, ReadDest &&read_dest, InitFn &&init, EmplaceFn &&emplace)
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...
Function parameter type for prioritizing overloaded function calls that would otherwise be ambiguous.
Definition util.h:115
Generic utility functions used by capnp code.
Definition util.h:39
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:82