/tmp/bitcoin/src/ipc/libmultiprocess/include/mp/type-vector.h
Line | Count | Source |
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 | | |
11 | | namespace mp { |
12 | | template <typename LocalType, typename Value, typename Output> |
13 | | void CustomBuildField(TypeList<std::vector<LocalType>>, |
14 | | Priority<1>, |
15 | | InvokeContext& invoke_context, |
16 | | Value&& value, |
17 | | Output&& output) |
18 | 0 | { |
19 | | // FIXME dedup with set handler below |
20 | 0 | auto list = output.init(value.size()); |
21 | 0 | size_t i = 0; |
22 | 0 | for (auto it = value.begin(); it != value.end(); ++it, ++i) { |
23 | 0 | BuildField(TypeList<LocalType>(), invoke_context, ListOutput<typename decltype(list)::Builds>(list, i), *it); |
24 | 0 | } |
25 | 0 | } Unexecuted instantiation: void mp::CustomBuildField<long, std::vector<long, std::allocator<long>>, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, ipc::capnp::messages::BlockTemplate::GetTxFeesResults::Builder>&>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, std::vector<long, std::allocator<long>>&&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, ipc::capnp::messages::BlockTemplate::GetTxFeesResults::Builder>&) Unexecuted instantiation: void mp::CustomBuildField<long, std::vector<long, std::allocator<long>>, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, ipc::capnp::messages::BlockTemplate::GetTxSigopsResults::Builder>&>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, std::vector<long, std::allocator<long>>&&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, ipc::capnp::messages::BlockTemplate::GetTxSigopsResults::Builder>&) Unexecuted instantiation: void mp::CustomBuildField<CTxOut, std::vector<CTxOut, std::allocator<CTxOut>>&, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Builder>&>(mp::TypeList<std::vector<CTxOut, std::allocator<CTxOut>>>, mp::Priority<1>, mp::InvokeContext&, std::vector<CTxOut, std::allocator<CTxOut>>&, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Builder>&) Unexecuted instantiation: void mp::CustomBuildField<uint256, std::vector<uint256, std::allocator<uint256>>, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults::Builder>&>(mp::TypeList<std::vector<uint256, std::allocator<uint256>>>, mp::Priority<1>, mp::InvokeContext&, std::vector<uint256, std::allocator<uint256>>&&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults::Builder>&) |
26 | | |
27 | | inline static bool BuildPrimitive(InvokeContext& invoke_context, std::vector<bool>::const_reference value, TypeList<bool>) |
28 | 0 | { |
29 | 0 | return value; |
30 | 0 | } Unexecuted instantiation: ipc_test.capnp.proxy-client.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: ipc_test.capnp.proxy-types.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: ipc_test.capnp.proxy-server.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: init.capnp.proxy-client.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: init.capnp.proxy-types.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: mining.capnp.proxy-types.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: rpc.capnp.proxy-types.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: init.capnp.proxy-server.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: mining.capnp.proxy-client.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: mining.capnp.proxy-server.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: rpc.capnp.proxy-client.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) Unexecuted instantiation: rpc.capnp.proxy-server.c++:mp::BuildPrimitive(mp::InvokeContext&, bool, mp::TypeList<bool>) |
31 | | |
32 | | template <typename LocalType, typename Input, typename ReadDest> |
33 | | decltype(auto) CustomReadField(TypeList<std::vector<LocalType>>, |
34 | | Priority<1>, |
35 | | InvokeContext& invoke_context, |
36 | | Input&& input, |
37 | | ReadDest&& read_dest) |
38 | 0 | { |
39 | 0 | return read_dest.update([&](auto& value) { |
40 | 0 | auto data = input.get(); |
41 | 0 | value.clear(); |
42 | 0 | value.reserve(data.size()); |
43 | 0 | for (auto item : data) { |
44 | 0 | ReadField(TypeList<LocalType>(), invoke_context, Make<ValueField>(item), |
45 | 0 | ReadDestEmplace(TypeList<LocalType>(), [&](auto&&... args) -> auto& { |
46 | 0 | value.emplace_back(std::forward<decltype(args)>(args)...); |
47 | 0 | return value.back(); |
48 | 0 | })); Unexecuted instantiation: auto& auto decltype(auto) mp::CustomReadField<long, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxFeesResults>>, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxFeesResults>>&&, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>&&)::'lambda'(long&)::operator()<std::vector<long, std::allocator<long>>>(long&) const::'lambda'(auto&&...)::operator()<long>(auto&&...) const Unexecuted instantiation: auto& auto decltype(auto) mp::CustomReadField<long, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxSigopsResults>>, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxSigopsResults>>&&, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>&&)::'lambda'(long&)::operator()<std::vector<long, std::allocator<long>>>(long&) const::'lambda'(auto&&...)::operator()<long>(auto&&...) const Unexecuted instantiation: auto& auto decltype(auto) mp::CustomReadField<CTxOut, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Reader const>, mp::ReadDestUpdate<std::vector<CTxOut, std::allocator<CTxOut>>>>(mp::TypeList<std::vector<CTxOut, std::allocator<CTxOut>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Reader const>&&, mp::ReadDestUpdate<std::vector<CTxOut, std::allocator<CTxOut>>>&&)::'lambda'(CTxOut&)::operator()<std::vector<CTxOut, std::allocator<CTxOut>>>(CTxOut&) const::'lambda'(auto&&...)::operator()<>(auto&&...) const Unexecuted instantiation: auto& auto decltype(auto) mp::CustomReadField<uint256, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults>>, mp::ReadDestUpdate<std::vector<uint256, std::allocator<uint256>>>>(mp::TypeList<std::vector<uint256, std::allocator<uint256>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults>>&&, mp::ReadDestUpdate<std::vector<uint256, std::allocator<uint256>>>&&)::'lambda'(uint256&)::operator()<std::vector<uint256, std::allocator<uint256>>>(uint256&) const::'lambda'(auto&&...)::operator()<>(auto&&...) const |
49 | 0 | } |
50 | 0 | }); Unexecuted instantiation: auto decltype(auto) mp::CustomReadField<long, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxFeesResults>>, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxFeesResults>>&&, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>&&)::'lambda'(long&)::operator()<std::vector<long, std::allocator<long>>>(long&) const Unexecuted instantiation: auto decltype(auto) mp::CustomReadField<long, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxSigopsResults>>, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxSigopsResults>>&&, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>&&)::'lambda'(long&)::operator()<std::vector<long, std::allocator<long>>>(long&) const Unexecuted instantiation: auto decltype(auto) mp::CustomReadField<CTxOut, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Reader const>, mp::ReadDestUpdate<std::vector<CTxOut, std::allocator<CTxOut>>>>(mp::TypeList<std::vector<CTxOut, std::allocator<CTxOut>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Reader const>&&, mp::ReadDestUpdate<std::vector<CTxOut, std::allocator<CTxOut>>>&&)::'lambda'(CTxOut&)::operator()<std::vector<CTxOut, std::allocator<CTxOut>>>(CTxOut&) const Unexecuted instantiation: auto decltype(auto) mp::CustomReadField<uint256, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults>>, mp::ReadDestUpdate<std::vector<uint256, std::allocator<uint256>>>>(mp::TypeList<std::vector<uint256, std::allocator<uint256>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults>>&&, mp::ReadDestUpdate<std::vector<uint256, std::allocator<uint256>>>&&)::'lambda'(uint256&)::operator()<std::vector<uint256, std::allocator<uint256>>>(uint256&) const |
51 | 0 | } Unexecuted instantiation: decltype(auto) mp::CustomReadField<long, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxFeesResults>>, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxFeesResults>>&&, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>&&) Unexecuted instantiation: decltype(auto) mp::CustomReadField<long, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxSigopsResults>>, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>>(mp::TypeList<std::vector<long, std::allocator<long>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetTxSigopsResults>>&&, mp::ReadDestUpdate<std::vector<long, std::allocator<long>>>&&) Unexecuted instantiation: decltype(auto) mp::CustomReadField<CTxOut, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Reader const>, mp::ReadDestUpdate<std::vector<CTxOut, std::allocator<CTxOut>>>>(mp::TypeList<std::vector<CTxOut, std::allocator<CTxOut>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::RequiredOutputs, 19>, ipc::capnp::messages::CoinbaseTx::Reader const>&&, mp::ReadDestUpdate<std::vector<CTxOut, std::allocator<CTxOut>>>&&) Unexecuted instantiation: decltype(auto) mp::CustomReadField<uint256, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults>>, mp::ReadDestUpdate<std::vector<uint256, std::allocator<uint256>>>>(mp::TypeList<std::vector<uint256, std::allocator<uint256>>>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::mining_fields::Result, 18>, capnp::Response<ipc::capnp::messages::BlockTemplate::GetCoinbaseMerklePathResults>>&&, mp::ReadDestUpdate<std::vector<uint256, std::allocator<uint256>>>&&) |
52 | | |
53 | | template <typename Input, typename ReadDest> |
54 | | decltype(auto) CustomReadField(TypeList<std::vector<bool>>, |
55 | | Priority<1>, |
56 | | InvokeContext& invoke_context, |
57 | | Input&& input, |
58 | | ReadDest&& read_dest) |
59 | | { |
60 | | return read_dest.update([&](auto& value) { |
61 | | auto data = input.get(); |
62 | | value.clear(); |
63 | | value.reserve(data.size()); |
64 | | for (auto item : data) { |
65 | | value.push_back(ReadField(TypeList<bool>(), invoke_context, Make<ValueField>(item), ReadDestTemp<bool>())); |
66 | | } |
67 | | }); |
68 | | } |
69 | | } // namespace mp |
70 | | |
71 | | #endif // MP_PROXY_TYPE_VECTOR_H |