/tmp/bitcoin/src/streams.h
Line | Count | Source |
1 | | // Copyright (c) 2009-2010 Satoshi Nakamoto |
2 | | // Copyright (c) 2009-present The Bitcoin Core developers |
3 | | // Distributed under the MIT software license, see the accompanying |
4 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
5 | | |
6 | | #ifndef BITCOIN_STREAMS_H |
7 | | #define BITCOIN_STREAMS_H |
8 | | |
9 | | #include <serialize.h> |
10 | | #include <span.h> |
11 | | #include <support/allocators/zeroafterfree.h> |
12 | | #include <util/check.h> |
13 | | #include <util/log.h> |
14 | | #include <util/obfuscation.h> |
15 | | #include <util/overflow.h> |
16 | | #include <util/syserror.h> |
17 | | |
18 | | #include <algorithm> |
19 | | #include <cassert> |
20 | | #include <cstddef> |
21 | | #include <cstdint> |
22 | | #include <cstdio> |
23 | | #include <cstring> |
24 | | #include <ios> |
25 | | #include <limits> |
26 | | #include <optional> |
27 | | #include <string> |
28 | | #include <vector> |
29 | | |
30 | | /* Minimal stream for overwriting and/or appending to an existing byte vector |
31 | | * |
32 | | * The referenced vector will grow as necessary |
33 | | */ |
34 | | class VectorWriter |
35 | | { |
36 | | public: |
37 | | /* |
38 | | * @param[in] vchDataIn Referenced byte vector to overwrite/append |
39 | | * @param[in] nPosIn Starting position. Vector index where writes should start. The vector will initially |
40 | | * grow as necessary to max(nPosIn, vec.size()). So to append, use vec.size(). |
41 | | */ |
42 | 338k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn) : vchData{vchDataIn}, nPos{nPosIn} |
43 | 338k | { |
44 | 338k | if(nPos > vchData.size()) |
45 | 1 | vchData.resize(nPos); |
46 | 338k | } |
47 | | /* |
48 | | * (other params same as above) |
49 | | * @param[in] args A list of items to serialize starting at nPosIn. |
50 | | */ |
51 | | template <typename... Args> |
52 | 319k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} |
53 | 319k | { |
54 | 319k | ::SerializeMany(*this, std::forward<Args>(args)...); |
55 | 319k | } VectorWriter::VectorWriter<int const&, unsigned long const&, long const&, unsigned long const&, ParamsWrapper<CAddress::SerParams, CService const>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, int const&, unsigned long const&, long const&, unsigned long const&, ParamsWrapper<CAddress::SerParams, CService const>&&) Line | Count | Source | 52 | 1 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 1 | { | 54 | 1 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 1 | } |
VectorWriter::VectorWriter<unsigned char&, unsigned char&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned char&, unsigned char&) Line | Count | Source | 52 | 10 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 10 | { | 54 | 10 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 10 | } |
VectorWriter::VectorWriter<unsigned char (&) [4]>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned char (&) [4]) Line | Count | Source | 52 | 2 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 2 | { | 54 | 2 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 2 | } |
VectorWriter::VectorWriter<unsigned char&, unsigned char (&) [4], unsigned char&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned char&, unsigned char (&) [4], unsigned char&) Line | Count | Source | 52 | 2 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 2 | { | 54 | 2 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 2 | } |
VectorWriter::VectorWriter<int&, Wrapper<CustomUintFormatter<8, false>, ServiceFlags&>, long, long, ParamsWrapper<CNetAddr::SerParams, CService>, long, ParamsWrapper<CNetAddr::SerParams, CService>, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, bool&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, int&, Wrapper<CustomUintFormatter<8, false>, ServiceFlags&>&&, long&&, long&&, ParamsWrapper<CNetAddr::SerParams, CService>&&, long&&, ParamsWrapper<CNetAddr::SerParams, CService>&&, unsigned long&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&&, int&&, bool&) Line | Count | Source | 52 | 2 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 2 | { | 54 | 2 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 2 | } |
VectorWriter::VectorWriter<CMessageHeader&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, CMessageHeader&) Line | Count | Source | 52 | 159k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 159k | { | 54 | 159k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 159k | } |
VectorWriter::VectorWriter<bool, unsigned long const&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, bool&&, unsigned long const&) Line | Count | Source | 52 | 1.82k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 1.82k | { | 54 | 1.82k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 1.82k | } |
VectorWriter::VectorWriter<CBlockHeaderAndShortTxIDs const&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, CBlockHeaderAndShortTxIDs const&) Line | Count | Source | 52 | 16.4k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 16.4k | { | 54 | 16.4k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 16.4k | } |
VectorWriter::VectorWriter<std::vector<CInv, std::allocator<CInv>>&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, std::vector<CInv, std::allocator<CInv>>&) Line | Count | Source | 52 | 65.2k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 65.2k | { | 54 | 65.2k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 65.2k | } |
VectorWriter::VectorWriter<ParamsWrapper<TransactionSerParams, CTransaction const>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, ParamsWrapper<TransactionSerParams, CTransaction const>&&) Line | Count | Source | 52 | 13.0k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 13.0k | { | 54 | 13.0k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 13.0k | } |
VectorWriter::VectorWriter<std::span<std::byte const, 18446744073709551615ul>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, std::span<std::byte const, 18446744073709551615ul>&&) Line | Count | Source | 52 | 27.8k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 27.8k | { | 54 | 27.8k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 27.8k | } |
VectorWriter::VectorWriter<ParamsWrapper<TransactionSerParams, CBlock const>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, ParamsWrapper<TransactionSerParams, CBlock const>&&) Line | Count | Source | 52 | 8.24k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 8.24k | { | 54 | 8.24k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 8.24k | } |
VectorWriter::VectorWriter<CMerkleBlock&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, CMerkleBlock&) Line | Count | Source | 52 | 4 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 4 | { | 54 | 4 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 4 | } |
VectorWriter::VectorWriter<CBlockHeaderAndShortTxIDs&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, CBlockHeaderAndShortTxIDs&) Line | Count | Source | 52 | 2.49k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 2.49k | { | 54 | 2.49k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 2.49k | } |
VectorWriter::VectorWriter<int const&, unsigned long&, long&, unsigned long&, ParamsWrapper<CNetAddr::SerParams, CService>, unsigned long&, ParamsWrapper<CNetAddr::SerParams, CService>, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int&, bool&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, int const&, unsigned long&, long&, unsigned long&, ParamsWrapper<CNetAddr::SerParams, CService>&&, unsigned long&, ParamsWrapper<CNetAddr::SerParams, CService>&&, unsigned long&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int&, bool&) Line | Count | Source | 52 | 1.55k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 1.55k | { | 54 | 1.55k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 1.55k | } |
VectorWriter::VectorWriter<unsigned int const&, unsigned long const&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned int const&, unsigned long const&) Line | Count | Source | 52 | 8 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 8 | { | 54 | 8 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 8 | } |
Unexecuted instantiation: VectorWriter::VectorWriter<std::array<std::byte, 168ul> const&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, std::array<std::byte, 168ul> const&) VectorWriter::VectorWriter<std::vector<CInv, std::allocator<CInv>>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, std::vector<CInv, std::allocator<CInv>>&&) Line | Count | Source | 52 | 10 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 10 | { | 54 | 10 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 10 | } |
VectorWriter::VectorWriter<CBlockLocator const&, uint256>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, CBlockLocator const&, uint256&&) Line | Count | Source | 52 | 3.33k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 3.33k | { | 54 | 3.33k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 3.33k | } |
VectorWriter::VectorWriter<BlockTransactions&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, BlockTransactions&) Line | Count | Source | 52 | 613 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 613 | { | 54 | 613 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 613 | } |
VectorWriter::VectorWriter<std::vector<CBlockHeader, std::allocator<CBlockHeader>>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, std::vector<CBlockHeader, std::allocator<CBlockHeader>>&&) Line | Count | Source | 52 | 9 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 9 | { | 54 | 9 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 9 | } |
VectorWriter::VectorWriter<ParamsWrapper<TransactionSerParams, std::vector<CBlock, std::allocator<CBlock>>>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, ParamsWrapper<TransactionSerParams, std::vector<CBlock, std::allocator<CBlock>>>&&) Line | Count | Source | 52 | 6.32k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 6.32k | { | 54 | 6.32k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 6.32k | } |
VectorWriter::VectorWriter<BlockTransactionsRequest&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, BlockTransactionsRequest&) Line | Count | Source | 52 | 601 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 601 | { | 54 | 601 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 601 | } |
VectorWriter::VectorWriter<unsigned long&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned long&) Line | Count | Source | 52 | 10.2k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 10.2k | { | 54 | 10.2k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 10.2k | } |
VectorWriter::VectorWriter<BlockFilter const&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, BlockFilter const&) Line | Count | Source | 52 | 11 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 11 | { | 54 | 11 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 11 | } |
VectorWriter::VectorWriter<unsigned char&, uint256, uint256&, std::vector<uint256, std::allocator<uint256>>&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned char&, uint256&&, uint256&, std::vector<uint256, std::allocator<uint256>>&) Line | Count | Source | 52 | 2 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 2 | { | 54 | 2 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 2 | } |
VectorWriter::VectorWriter<unsigned char&, uint256, std::vector<uint256, std::allocator<uint256>>&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, unsigned char&, uint256&&, std::vector<uint256, std::allocator<uint256>>&) Line | Count | Source | 52 | 3 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 3 | { | 54 | 3 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 3 | } |
VectorWriter::VectorWriter<ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>>>>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>>>&&) Line | Count | Source | 52 | 130 | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 130 | { | 54 | 130 | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 130 | } |
VectorWriter::VectorWriter<long&>(std::vector<unsigned char, std::allocator<unsigned char>>&, unsigned long, long&) Line | Count | Source | 52 | 1.67k | VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn} | 53 | 1.67k | { | 54 | 1.67k | ::SerializeMany(*this, std::forward<Args>(args)...); | 55 | 1.67k | } |
|
56 | | void write(std::span<const std::byte> src) |
57 | 6.60M | { |
58 | 6.60M | assert(nPos <= vchData.size()); |
59 | 6.60M | size_t nOverwrite = std::min(src.size(), vchData.size() - nPos); |
60 | 6.60M | if (nOverwrite) { |
61 | 19 | memcpy(vchData.data() + nPos, src.data(), nOverwrite); |
62 | 19 | } |
63 | 6.60M | if (nOverwrite < src.size()) { |
64 | 6.60M | vchData.insert(vchData.end(), UCharCast(src.data()) + nOverwrite, UCharCast(src.data() + src.size())); |
65 | 6.60M | } |
66 | 6.60M | nPos += src.size(); |
67 | 6.60M | } |
68 | | template <typename T> |
69 | | VectorWriter& operator<<(const T& obj) |
70 | 373k | { |
71 | 373k | ::Serialize(*this, obj); |
72 | 373k | return (*this); |
73 | 373k | } cluster_linearize_tests.cpp:VectorWriter& VectorWriter::operator<<<Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned long>> const&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned long>> const&> const&) Line | Count | Source | 70 | 227 | { | 71 | 227 | ::Serialize(*this, obj); | 72 | 227 | return (*this); | 73 | 227 | } |
VectorWriter& VectorWriter::operator<<<Wrapper<VarIntFormatter<(VarIntMode)1>, int const&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, int const&> const&) Line | Count | Source | 70 | 25.0k | { | 71 | 25.0k | ::Serialize(*this, obj); | 72 | 25.0k | return (*this); | 73 | 25.0k | } |
VectorWriter& VectorWriter::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&> const&) Line | Count | Source | 70 | 124k | { | 71 | 124k | ::Serialize(*this, obj); | 72 | 124k | return (*this); | 73 | 124k | } |
VectorWriter& VectorWriter::operator<<<unsigned char>(unsigned char const&) Line | Count | Source | 70 | 26.4k | { | 71 | 26.4k | ::Serialize(*this, obj); | 72 | 26.4k | return (*this); | 73 | 26.4k | } |
cluster_linearize_tests.cpp:VectorWriter& VectorWriter::operator<<<Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned int, 2u>> const&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned int, 2u>> const&> const&) Line | Count | Source | 70 | 227 | { | 71 | 227 | ::Serialize(*this, obj); | 72 | 227 | return (*this); | 73 | 227 | } |
cluster_linearize_tests.cpp:VectorWriter& VectorWriter::operator<<<Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 8u>> const&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 8u>> const&> const&) Line | Count | Source | 70 | 227 | { | 71 | 227 | ::Serialize(*this, obj); | 72 | 227 | return (*this); | 73 | 227 | } |
cluster_linearize_tests.cpp:VectorWriter& VectorWriter::operator<<<Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned int>> const&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned int>> const&> const&) Line | Count | Source | 70 | 132 | { | 71 | 132 | ::Serialize(*this, obj); | 72 | 132 | return (*this); | 73 | 132 | } |
cluster_linearize_tests.cpp:VectorWriter& VectorWriter::operator<<<Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 4u>> const&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 4u>> const&> const&) Line | Count | Source | 70 | 125 | { | 71 | 125 | ::Serialize(*this, obj); | 72 | 125 | return (*this); | 73 | 125 | } |
cluster_linearize_tests.cpp:VectorWriter& VectorWriter::operator<<<Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned int>>&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned int>>&> const&) Line | Count | Source | 70 | 7 | { | 71 | 7 | ::Serialize(*this, obj); | 72 | 7 | return (*this); | 73 | 7 | } |
VectorWriter& VectorWriter::operator<<<std::set<uint256, std::less<uint256>, std::allocator<uint256>>>(std::set<uint256, std::less<uint256>, std::allocator<uint256>> const&) Line | Count | Source | 70 | 3.79k | { | 71 | 3.79k | ::Serialize(*this, obj); | 72 | 3.79k | return (*this); | 73 | 3.79k | } |
VectorWriter& VectorWriter::operator<<<std::span<unsigned char const, 32ul>>(std::span<unsigned char const, 32ul> const&) Line | Count | Source | 70 | 178k | { | 71 | 178k | ::Serialize(*this, obj); | 72 | 178k | return (*this); | 73 | 178k | } |
VectorWriter& VectorWriter::operator<<<unsigned char [4]>(unsigned char const (&) [4]) Line | Count | Source | 70 | 3.79k | { | 71 | 3.79k | ::Serialize(*this, obj); | 72 | 3.79k | return (*this); | 73 | 3.79k | } |
VectorWriter& VectorWriter::operator<<<unsigned int>(unsigned int const&) Line | Count | Source | 70 | 7.10k | { | 71 | 7.10k | ::Serialize(*this, obj); | 72 | 7.10k | return (*this); | 73 | 7.10k | } |
VectorWriter& VectorWriter::operator<<<std::span<unsigned char const, 18446744073709551615ul>>(std::span<unsigned char const, 18446744073709551615ul> const&) Line | Count | Source | 70 | 1.46k | { | 71 | 1.46k | ::Serialize(*this, obj); | 72 | 1.46k | return (*this); | 73 | 1.46k | } |
VectorWriter& VectorWriter::operator<<<std::vector<unsigned char, std::allocator<unsigned char>>>(std::vector<unsigned char, std::allocator<unsigned char>> const&) Line | Count | Source | 70 | 706 | { | 71 | 706 | ::Serialize(*this, obj); | 72 | 706 | return (*this); | 73 | 706 | } |
VectorWriter& VectorWriter::operator<<<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) Line | Count | Source | 70 | 1 | { | 71 | 1 | ::Serialize(*this, obj); | 72 | 1 | return (*this); | 73 | 1 | } |
VectorWriter& VectorWriter::operator<<<unsigned long>(unsigned long const&) Line | Count | Source | 70 | 1 | { | 71 | 1 | ::Serialize(*this, obj); | 72 | 1 | return (*this); | 73 | 1 | } |
VectorWriter& VectorWriter::operator<<<int>(int const&) Line | Count | Source | 70 | 29 | { | 71 | 29 | ::Serialize(*this, obj); | 72 | 29 | return (*this); | 73 | 29 | } |
VectorWriter& VectorWriter::operator<<<uint256>(uint256 const&) Line | Count | Source | 70 | 63 | { | 71 | 63 | ::Serialize(*this, obj); | 72 | 63 | return (*this); | 73 | 63 | } |
|
74 | | |
75 | | private: |
76 | | std::vector<unsigned char>& vchData; |
77 | | size_t nPos; |
78 | | }; |
79 | | |
80 | | /** Minimal stream for reading from an existing byte array by std::span. |
81 | | */ |
82 | | class SpanReader |
83 | | { |
84 | | private: |
85 | | std::span<const std::byte> m_data; |
86 | | |
87 | | public: |
88 | | /** |
89 | | * @param[in] data Referenced byte vector to overwrite/append |
90 | | */ |
91 | 89.0k | explicit SpanReader(std::span<const unsigned char> data) : m_data{std::as_bytes(data)} {} |
92 | 603k | explicit SpanReader(std::span<const std::byte> data) : m_data{data} {} |
93 | | |
94 | | template<typename T> |
95 | | SpanReader& operator>>(T&& obj) |
96 | 1.52M | { |
97 | 1.52M | ::Unserialize(*this, obj); |
98 | 1.52M | return (*this); |
99 | 1.52M | } SpanReader& SpanReader::operator>><unsigned int&>(unsigned int&) Line | Count | Source | 96 | 15.2k | { | 97 | 15.2k | ::Unserialize(*this, obj); | 98 | 15.2k | return (*this); | 99 | 15.2k | } |
SpanReader& SpanReader::operator>><std::vector<CTxIn, std::allocator<CTxIn>>&>(std::vector<CTxIn, std::allocator<CTxIn>>&) Line | Count | Source | 96 | 1 | { | 97 | 1 | ::Unserialize(*this, obj); | 98 | 1 | return (*this); | 99 | 1 | } |
SpanReader& SpanReader::operator>><unsigned char&>(unsigned char&) Line | Count | Source | 96 | 34.2k | { | 97 | 34.2k | ::Unserialize(*this, obj); | 98 | 34.2k | return (*this); | 99 | 34.2k | } |
SpanReader& SpanReader::operator>><std::vector<CTxOut, std::allocator<CTxOut>>&>(std::vector<CTxOut, std::allocator<CTxOut>>&) Line | Count | Source | 96 | 1 | { | 97 | 1 | ::Unserialize(*this, obj); | 98 | 1 | return (*this); | 99 | 1 | } |
SpanReader& SpanReader::operator>><std::vector<std::vector<unsigned char, std::allocator<unsigned char>>, std::allocator<std::vector<unsigned char, std::allocator<unsigned char>>>>&>(std::vector<std::vector<unsigned char, std::allocator<unsigned char>>, std::allocator<std::vector<unsigned char, std::allocator<unsigned char>>>>&) Line | Count | Source | 96 | 19 | { | 97 | 19 | ::Unserialize(*this, obj); | 98 | 19 | return (*this); | 99 | 19 | } |
cluster_linearize_tests.cpp:SpanReader& SpanReader::operator>><Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned long>>&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned long>>&>&&) Line | Count | Source | 96 | 681 | { | 97 | 681 | ::Unserialize(*this, obj); | 98 | 681 | return (*this); | 99 | 681 | } |
SpanReader& SpanReader::operator>><Wrapper<VarIntFormatter<(VarIntMode)1>, int&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, int&>&&) Line | Count | Source | 96 | 77.9k | { | 97 | 77.9k | ::Unserialize(*this, obj); | 98 | 77.9k | return (*this); | 99 | 77.9k | } |
SpanReader& SpanReader::operator>><Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>&&) Line | Count | Source | 96 | 475k | { | 97 | 475k | ::Unserialize(*this, obj); | 98 | 475k | return (*this); | 99 | 475k | } |
cluster_linearize_tests.cpp:SpanReader& SpanReader::operator>><Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned int, 2u>>&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned int, 2u>>&>&&) Line | Count | Source | 96 | 681 | { | 97 | 681 | ::Unserialize(*this, obj); | 98 | 681 | return (*this); | 99 | 681 | } |
cluster_linearize_tests.cpp:SpanReader& SpanReader::operator>><Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 8u>>&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 8u>>&>&&) Line | Count | Source | 96 | 681 | { | 97 | 681 | ::Unserialize(*this, obj); | 98 | 681 | return (*this); | 99 | 681 | } |
cluster_linearize_tests.cpp:SpanReader& SpanReader::operator>><Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned int>>&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::IntBitSet<unsigned int>>&>&&) Line | Count | Source | 96 | 396 | { | 97 | 396 | ::Unserialize(*this, obj); | 98 | 396 | return (*this); | 99 | 396 | } |
cluster_linearize_tests.cpp:SpanReader& SpanReader::operator>><Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 4u>>&>>(Wrapper<(anonymous namespace)::DepGraphFormatter, cluster_linearize::DepGraph<bitset_detail::MultiIntBitSet<unsigned char, 4u>>&>&&) Line | Count | Source | 96 | 375 | { | 97 | 375 | ::Unserialize(*this, obj); | 98 | 375 | return (*this); | 99 | 375 | } |
SpanReader& SpanReader::operator>><Coin&>(Coin&) Line | Count | Source | 96 | 100k | { | 97 | 100k | ::Unserialize(*this, obj); | 98 | 100k | return (*this); | 99 | 100k | } |
SpanReader& SpanReader::operator>><Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>&&) Line | Count | Source | 96 | 100k | { | 97 | 100k | ::Unserialize(*this, obj); | 98 | 100k | return (*this); | 99 | 100k | } |
SpanReader& SpanReader::operator>><std::span<unsigned char, 18446744073709551615ul>>(std::span<unsigned char, 18446744073709551615ul>&&) Line | Count | Source | 96 | 100k | { | 97 | 100k | ::Unserialize(*this, obj); | 98 | 100k | return (*this); | 99 | 100k | } |
SpanReader& SpanReader::operator>><uint256&>(uint256&) Line | Count | Source | 96 | 6.96k | { | 97 | 6.96k | ::Unserialize(*this, obj); | 98 | 6.96k | return (*this); | 99 | 6.96k | } |
SpanReader& SpanReader::operator>><bool&>(bool&) Line | Count | Source | 96 | 4 | { | 97 | 4 | ::Unserialize(*this, obj); | 98 | 4 | return (*this); | 99 | 4 | } |
SpanReader& SpanReader::operator>><unsigned short&>(unsigned short&) Line | Count | Source | 96 | 2 | { | 97 | 2 | ::Unserialize(*this, obj); | 98 | 2 | return (*this); | 99 | 2 | } |
SpanReader& SpanReader::operator>><dbwrapper_tests::StringContentsSerializer&>(dbwrapper_tests::StringContentsSerializer&) Line | Count | Source | 96 | 150 | { | 97 | 150 | ::Unserialize(*this, obj); | 98 | 150 | return (*this); | 99 | 150 | } |
SpanReader& SpanReader::operator>><ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>>>>(ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>>>&&) Line | Count | Source | 96 | 3 | { | 97 | 3 | ::Unserialize(*this, obj); | 98 | 3 | return (*this); | 99 | 3 | } |
SpanReader& SpanReader::operator>><ParamsWrapper<TransactionSerParams, CMutableTransaction>>(ParamsWrapper<TransactionSerParams, CMutableTransaction>&&) Line | Count | Source | 96 | 33.2k | { | 97 | 33.2k | ::Unserialize(*this, obj); | 98 | 33.2k | return (*this); | 99 | 33.2k | } |
SpanReader& SpanReader::operator>><CTxOut&>(CTxOut&) Line | Count | Source | 96 | 2.92k | { | 97 | 2.92k | ::Unserialize(*this, obj); | 98 | 2.92k | return (*this); | 99 | 2.92k | } |
SpanReader& SpanReader::operator>><ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const>>>(ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const>>&&) Line | Count | Source | 96 | 500 | { | 97 | 500 | ::Unserialize(*this, obj); | 98 | 500 | return (*this); | 99 | 500 | } |
SpanReader& SpanReader::operator>><signed char&>(signed char&) Line | Count | Source | 96 | 1 | { | 97 | 1 | ::Unserialize(*this, obj); | 98 | 1 | return (*this); | 99 | 1 | } |
SpanReader& SpanReader::operator>><int&>(int&) Line | Count | Source | 96 | 739 | { | 97 | 739 | ::Unserialize(*this, obj); | 98 | 739 | return (*this); | 99 | 739 | } |
SpanReader& SpanReader::operator>><std::vector<unsigned char, std::allocator<unsigned char>>&>(std::vector<unsigned char, std::allocator<unsigned char>>&) Line | Count | Source | 96 | 43.6k | { | 97 | 43.6k | ::Unserialize(*this, obj); | 98 | 43.6k | return (*this); | 99 | 43.6k | } |
SpanReader& SpanReader::operator>><XOnlyPubKey&>(XOnlyPubKey&) Line | Count | Source | 96 | 4.06k | { | 97 | 4.06k | ::Unserialize(*this, obj); | 98 | 4.06k | return (*this); | 99 | 4.06k | } |
SpanReader& SpanReader::operator>><std::span<std::byte, 33ul>>(std::span<std::byte, 33ul>&&) Line | Count | Source | 96 | 6.10k | { | 97 | 6.10k | ::Unserialize(*this, obj); | 98 | 6.10k | return (*this); | 99 | 6.10k | } |
SpanReader& SpanReader::operator>><wallet::WalletDescriptor&>(wallet::WalletDescriptor&) Line | Count | Source | 96 | 1 | { | 97 | 1 | ::Unserialize(*this, obj); | 98 | 1 | return (*this); | 99 | 1 | } |
SpanReader& SpanReader::operator>><Obfuscation&>(Obfuscation&) Line | Count | Source | 96 | 850 | { | 97 | 850 | ::Unserialize(*this, obj); | 98 | 850 | return (*this); | 99 | 850 | } |
SpanReader& SpanReader::operator>><std::vector<std::byte, std::allocator<std::byte>>&>(std::vector<std::byte, std::allocator<std::byte>>&) Line | Count | Source | 96 | 850 | { | 97 | 850 | ::Unserialize(*this, obj); | 98 | 850 | return (*this); | 99 | 850 | } |
SpanReader& SpanReader::operator>><CBlockLocator&>(CBlockLocator&) Line | Count | Source | 96 | 95 | { | 97 | 95 | ::Unserialize(*this, obj); | 98 | 95 | return (*this); | 99 | 95 | } |
SpanReader& SpanReader::operator>><index_util::DBHeightKey&>(index_util::DBHeightKey&) Line | Count | Source | 96 | 3.09k | { | 97 | 3.09k | ::Unserialize(*this, obj); | 98 | 3.09k | return (*this); | 99 | 3.09k | } |
blockfilterindex.cpp:SpanReader& SpanReader::operator>><(anonymous namespace)::DBVal&>((anonymous namespace)::DBVal&) Line | Count | Source | 96 | 29 | { | 97 | 29 | ::Unserialize(*this, obj); | 98 | 29 | return (*this); | 99 | 29 | } |
SpanReader& SpanReader::operator>><FlatFilePos&>(FlatFilePos&) Line | Count | Source | 96 | 26 | { | 97 | 26 | ::Unserialize(*this, obj); | 98 | 26 | return (*this); | 99 | 26 | } |
blockfilterindex.cpp:SpanReader& SpanReader::operator>><std::pair<uint256, (anonymous namespace)::DBVal>&>(std::pair<uint256, (anonymous namespace)::DBVal>&) Line | Count | Source | 96 | 1.01k | { | 97 | 1.01k | ::Unserialize(*this, obj); | 98 | 1.01k | return (*this); | 99 | 1.01k | } |
coinstatsindex.cpp:SpanReader& SpanReader::operator>><(anonymous namespace)::DBVal&>((anonymous namespace)::DBVal&) Line | Count | Source | 96 | 2 | { | 97 | 2 | ::Unserialize(*this, obj); | 98 | 2 | return (*this); | 99 | 2 | } |
SpanReader& SpanReader::operator>><MuHash3072&>(MuHash3072&) Line | Count | Source | 96 | 30 | { | 97 | 30 | ::Unserialize(*this, obj); | 98 | 30 | return (*this); | 99 | 30 | } |
coinstatsindex.cpp:SpanReader& SpanReader::operator>><std::pair<uint256, (anonymous namespace)::DBVal>&>(std::pair<uint256, (anonymous namespace)::DBVal>&) Line | Count | Source | 96 | 220 | { | 97 | 220 | ::Unserialize(*this, obj); | 98 | 220 | return (*this); | 99 | 220 | } |
SpanReader& SpanReader::operator>><CDiskTxPos&>(CDiskTxPos&) Line | Count | Source | 96 | 142 | { | 97 | 142 | ::Unserialize(*this, obj); | 98 | 142 | return (*this); | 99 | 142 | } |
SpanReader& SpanReader::operator>><std::pair<unsigned long, unsigned long>&>(std::pair<unsigned long, unsigned long>&) Line | Count | Source | 96 | 16 | { | 97 | 16 | ::Unserialize(*this, obj); | 98 | 16 | return (*this); | 99 | 16 | } |
SpanReader& SpanReader::operator>><DBKey&>(DBKey&) Line | Count | Source | 96 | 28 | { | 97 | 28 | ::Unserialize(*this, obj); | 98 | 28 | return (*this); | 99 | 28 | } |
SpanReader& SpanReader::operator>><kernel::CBlockFileInfo&>(kernel::CBlockFileInfo&) Line | Count | Source | 96 | 752 | { | 97 | 752 | ::Unserialize(*this, obj); | 98 | 752 | return (*this); | 99 | 752 | } |
SpanReader& SpanReader::operator>><std::pair<unsigned char, uint256>&>(std::pair<unsigned char, uint256>&) Line | Count | Source | 96 | 133k | { | 97 | 133k | ::Unserialize(*this, obj); | 98 | 133k | return (*this); | 99 | 133k | } |
SpanReader& SpanReader::operator>><ParamsWrapper<TransactionSerParams, CBlock>>(ParamsWrapper<TransactionSerParams, CBlock>&&) Line | Count | Source | 96 | 136k | { | 97 | 136k | ::Unserialize(*this, obj); | 98 | 136k | return (*this); | 99 | 136k | } |
SpanReader& SpanReader::operator>><CMerkleBlock&>(CMerkleBlock&) Line | Count | Source | 96 | 19 | { | 97 | 19 | ::Unserialize(*this, obj); | 98 | 19 | return (*this); | 99 | 19 | } |
SpanReader& SpanReader::operator>><CScript&>(CScript&) Line | Count | Source | 96 | 2.50k | { | 97 | 2.50k | ::Unserialize(*this, obj); | 98 | 2.50k | return (*this); | 99 | 2.50k | } |
Unexecuted instantiation: SpanReader& SpanReader::operator>><std::vector<uint256, std::allocator<uint256>>&>(std::vector<uint256, std::allocator<uint256>>&) txdb.cpp:SpanReader& SpanReader::operator>><(anonymous namespace)::CoinEntry&>((anonymous namespace)::CoinEntry&) Line | Count | Source | 96 | 224k | { | 97 | 224k | ::Unserialize(*this, obj); | 98 | 224k | return (*this); | 99 | 224k | } |
SpanReader& SpanReader::operator>><CBlockHeader&>(CBlockHeader&) Line | Count | Source | 96 | 1.84k | { | 97 | 1.84k | ::Unserialize(*this, obj); | 98 | 1.84k | return (*this); | 99 | 1.84k | } |
SpanReader& SpanReader::operator>><unsigned char (&) [5]>(unsigned char (&) [5]) Line | Count | Source | 96 | 1.40k | { | 97 | 1.40k | ::Unserialize(*this, obj); | 98 | 1.40k | return (*this); | 99 | 1.40k | } |
SpanReader& SpanReader::operator>><unsigned char (&) [4]>(unsigned char (&) [4]) Line | Count | Source | 96 | 7.53k | { | 97 | 7.53k | ::Unserialize(*this, obj); | 98 | 7.53k | return (*this); | 99 | 7.53k | } |
SpanReader& SpanReader::operator>><PSBTInput&>(PSBTInput&) Line | Count | Source | 96 | 190 | { | 97 | 190 | ::Unserialize(*this, obj); | 98 | 190 | return (*this); | 99 | 190 | } |
SpanReader& SpanReader::operator>><std::set<uint256, std::less<uint256>, std::allocator<uint256>>&>(std::set<uint256, std::less<uint256>, std::allocator<uint256>>&) Line | Count | Source | 96 | 6.68k | { | 97 | 6.68k | ::Unserialize(*this, obj); | 98 | 6.68k | return (*this); | 99 | 6.68k | } |
SpanReader& SpanReader::operator>><PSBTOutput&>(PSBTOutput&) Line | Count | Source | 96 | 148 | { | 97 | 148 | ::Unserialize(*this, obj); | 98 | 148 | return (*this); | 99 | 148 | } |
|
100 | | |
101 | 52.5k | size_t size() const { return m_data.size(); } |
102 | 98.6k | bool empty() const { return m_data.empty(); } |
103 | | |
104 | | void read(std::span<std::byte> dst) |
105 | 10.4M | { |
106 | 10.4M | if (dst.size() == 0) { |
107 | 1.41k | return; |
108 | 1.41k | } |
109 | | |
110 | | // Read from the beginning of the buffer |
111 | 10.4M | if (dst.size() > m_data.size()) { |
112 | 1.87k | throw std::ios_base::failure("SpanReader::read(): end of data"); |
113 | 1.87k | } |
114 | 10.4M | memcpy(dst.data(), m_data.data(), dst.size()); |
115 | 10.4M | m_data = m_data.subspan(dst.size()); |
116 | 10.4M | } |
117 | | |
118 | | void ignore(size_t n) |
119 | 1 | { |
120 | 1 | if (n > m_data.size()) { |
121 | 1 | throw std::ios_base::failure("SpanReader::ignore(): end of data"); |
122 | 1 | } |
123 | 0 | m_data = m_data.subspan(n); |
124 | 0 | } |
125 | | }; |
126 | | |
127 | | /** Minimal stream for writing to an existing span of bytes. |
128 | | */ |
129 | | class SpanWriter |
130 | | { |
131 | | private: |
132 | | std::span<std::byte> m_dest; |
133 | | |
134 | | public: |
135 | 4 | explicit SpanWriter(std::span<std::byte> dest) : m_dest{dest} {} |
136 | | template <typename... Args> |
137 | 2 | SpanWriter(std::span<std::byte> dest, Args&&... args) : SpanWriter{dest} |
138 | 2 | { |
139 | 2 | ::SerializeMany(*this, std::forward<Args>(args)...); |
140 | 2 | } SpanWriter::SpanWriter<unsigned char&, unsigned char (&) [4], unsigned char&>(std::span<std::byte, 18446744073709551615ul>, unsigned char&, unsigned char (&) [4], unsigned char&) Line | Count | Source | 137 | 1 | SpanWriter(std::span<std::byte> dest, Args&&... args) : SpanWriter{dest} | 138 | 1 | { | 139 | 1 | ::SerializeMany(*this, std::forward<Args>(args)...); | 140 | 1 | } |
SpanWriter::SpanWriter<unsigned char&, unsigned char&>(std::span<std::byte, 18446744073709551615ul>, unsigned char&, unsigned char&) Line | Count | Source | 137 | 1 | SpanWriter(std::span<std::byte> dest, Args&&... args) : SpanWriter{dest} | 138 | 1 | { | 139 | 1 | ::SerializeMany(*this, std::forward<Args>(args)...); | 140 | 1 | } |
|
141 | | |
142 | | void write(std::span<const std::byte> src) |
143 | 9 | { |
144 | 9 | if (src.size() > m_dest.size()) { |
145 | 2 | throw std::ios_base::failure("SpanWriter::write(): exceeded buffer size"); |
146 | 2 | } |
147 | 7 | memcpy(m_dest.data(), src.data(), src.size()); |
148 | 7 | m_dest = m_dest.subspan(src.size()); |
149 | 7 | } |
150 | | |
151 | | template<typename T> |
152 | | SpanWriter& operator<<(const T& obj) |
153 | 4 | { |
154 | 4 | ::Serialize(*this, obj); |
155 | 4 | return *this; |
156 | 4 | } |
157 | | }; |
158 | | |
159 | | /** Double ended buffer combining vector and stream-like interfaces. |
160 | | * |
161 | | * >> and << read and write unformatted data using the above serialization templates. |
162 | | * Fills with data in linear time; some stringstream implementations take N^2 time. |
163 | | */ |
164 | | class DataStream |
165 | | { |
166 | | protected: |
167 | | using vector_type = SerializeData; |
168 | | vector_type vch; |
169 | | vector_type::size_type m_read_pos{0}; |
170 | | |
171 | | public: |
172 | | typedef vector_type::allocator_type allocator_type; |
173 | | typedef vector_type::size_type size_type; |
174 | | typedef vector_type::difference_type difference_type; |
175 | | typedef vector_type::reference reference; |
176 | | typedef vector_type::const_reference const_reference; |
177 | | typedef vector_type::value_type value_type; |
178 | | typedef vector_type::iterator iterator; |
179 | | typedef vector_type::const_iterator const_iterator; |
180 | | typedef vector_type::reverse_iterator reverse_iterator; |
181 | | |
182 | 7.54M | explicit DataStream() = default; |
183 | 214 | explicit DataStream(std::span<const uint8_t> sp) : DataStream{std::as_bytes(sp)} {} |
184 | 234 | explicit DataStream(std::span<const value_type> sp) : vch(sp.data(), sp.data() + sp.size()) {} |
185 | | |
186 | | std::string str() const |
187 | 767 | { |
188 | 767 | return std::string{UCharCast(data()), UCharCast(data() + size())}; |
189 | 767 | } |
190 | | |
191 | | // |
192 | | // Vector subset |
193 | | // |
194 | 0 | const_iterator begin() const { return vch.begin() + m_read_pos; } |
195 | 192k | iterator begin() { return vch.begin() + m_read_pos; } |
196 | 0 | const_iterator end() const { return vch.end(); } |
197 | 97.4k | iterator end() { return vch.end(); } |
198 | 18.7M | size_type size() const { return vch.size() - m_read_pos; } |
199 | 1.31M | bool empty() const { return vch.size() == m_read_pos; } |
200 | 312k | void resize(size_type n, value_type c = value_type{}) { vch.resize(n + m_read_pos, c); } |
201 | 6.82M | void reserve(size_type n) { vch.reserve(n + m_read_pos); } |
202 | 0 | const_reference operator[](size_type pos) const { return vch[pos + m_read_pos]; } |
203 | 18.3M | reference operator[](size_type pos) { return vch[pos + m_read_pos]; } |
204 | 2.33M | void clear() { vch.clear(); m_read_pos = 0; } |
205 | 8.48M | value_type* data() { return vch.data() + m_read_pos; } |
206 | 7.51k | const value_type* data() const { return vch.data() + m_read_pos; } |
207 | | |
208 | | // |
209 | | // Stream subset |
210 | | // |
211 | | void read(std::span<value_type> dst) |
212 | 12.3M | { |
213 | 12.3M | if (dst.size() == 0) return; |
214 | | |
215 | | // Read from the beginning of the buffer |
216 | 12.3M | auto next_read_pos{CheckedAdd(m_read_pos, dst.size())}; |
217 | 12.3M | if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) { |
218 | 2.23k | throw std::ios_base::failure("DataStream::read(): end of data"); |
219 | 2.23k | } |
220 | 12.3M | memcpy(dst.data(), &vch[m_read_pos], dst.size()); |
221 | 12.3M | if (next_read_pos.value() == vch.size()) { |
222 | | // If fully consumed, reset to empty state. |
223 | 721k | clear(); |
224 | 721k | return; |
225 | 721k | } |
226 | 11.5M | m_read_pos = next_read_pos.value(); |
227 | 11.5M | } |
228 | | |
229 | | void ignore(size_t num_ignore) |
230 | 3.07k | { |
231 | | // Ignore from the beginning of the buffer |
232 | 3.07k | auto next_read_pos{CheckedAdd(m_read_pos, num_ignore)}; |
233 | 3.07k | if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) { |
234 | 0 | throw std::ios_base::failure("DataStream::ignore(): end of data"); |
235 | 0 | } |
236 | 3.07k | if (next_read_pos.value() == vch.size()) { |
237 | | // If all bytes are ignored, reset to empty state. |
238 | 3 | clear(); |
239 | 3 | return; |
240 | 3 | } |
241 | 3.07k | m_read_pos = next_read_pos.value(); |
242 | 3.07k | } |
243 | | |
244 | | void write(std::span<const value_type> src) |
245 | 44.5M | { |
246 | | // Write to the end of the buffer |
247 | 44.5M | vch.insert(vch.end(), src.begin(), src.end()); |
248 | 44.5M | } |
249 | | |
250 | | template<typename T> |
251 | | DataStream& operator<<(const T& obj) |
252 | 17.1M | { |
253 | 17.1M | ::Serialize(*this, obj); |
254 | 17.1M | return (*this); |
255 | 17.1M | } DataStream& DataStream::operator<<<std::array<unsigned char, 4ul>>(std::array<unsigned char, 4ul> const&) Line | Count | Source | 252 | 4 | { | 253 | 4 | ::Serialize(*this, obj); | 254 | 4 | return (*this); | 255 | 4 | } |
DataStream& DataStream::operator<<<unsigned char>(unsigned char const&) Line | Count | Source | 252 | 46.9k | { | 253 | 46.9k | ::Serialize(*this, obj); | 254 | 46.9k | return (*this); | 255 | 46.9k | } |
DataStream& DataStream::operator<<<uint256>(uint256 const&) Line | Count | Source | 252 | 31.2k | { | 253 | 31.2k | ::Serialize(*this, obj); | 254 | 31.2k | return (*this); | 255 | 31.2k | } |
DataStream& DataStream::operator<<<std::span<unsigned char const, 32ul>>(std::span<unsigned char const, 32ul> const&) Line | Count | Source | 252 | 7.63M | { | 253 | 7.63M | ::Serialize(*this, obj); | 254 | 7.63M | return (*this); | 255 | 7.63M | } |
DataStream& DataStream::operator<<<int>(int const&) Line | Count | Source | 252 | 27.4k | { | 253 | 27.4k | ::Serialize(*this, obj); | 254 | 27.4k | return (*this); | 255 | 27.4k | } |
DataStream& DataStream::operator<<<ParamsWrapper<CAddress::SerParams, AddrInfo>>(ParamsWrapper<CAddress::SerParams, AddrInfo> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<AddrMan>(AddrMan const&) Line | Count | Source | 252 | 7 | { | 253 | 7 | ::Serialize(*this, obj); | 254 | 7 | return (*this); | 255 | 7 | } |
DataStream& DataStream::operator<<<CBlockHeaderAndShortTxIDs>(CBlockHeaderAndShortTxIDs const&) Line | Count | Source | 252 | 4 | { | 253 | 4 | ::Serialize(*this, obj); | 254 | 4 | return (*this); | 255 | 4 | } |
DataStream& DataStream::operator<<<blockencodings_tests::TestHeaderAndShortIDs>(blockencodings_tests::TestHeaderAndShortIDs const&) Line | Count | Source | 252 | 5 | { | 253 | 5 | ::Serialize(*this, obj); | 254 | 5 | return (*this); | 255 | 5 | } |
DataStream& DataStream::operator<<<BlockTransactionsRequest>(BlockTransactionsRequest const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<BlockFilter>(BlockFilter const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::vector<unsigned char, std::allocator<unsigned char>>>(std::vector<unsigned char, std::allocator<unsigned char>> const&) Line | Count | Source | 252 | 73.4k | { | 253 | 73.4k | ::Serialize(*this, obj); | 254 | 73.4k | return (*this); | 255 | 73.4k | } |
DataStream& DataStream::operator<<<CBloomFilter>(CBloomFilter const&) Line | Count | Source | 252 | 3 | { | 253 | 3 | ::Serialize(*this, obj); | 254 | 3 | return (*this); | 255 | 3 | } |
DataStream& DataStream::operator<<<CMerkleBlock>(CMerkleBlock const&) Line | Count | Source | 252 | 13 | { | 253 | 13 | ::Serialize(*this, obj); | 254 | 13 | return (*this); | 255 | 13 | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&> const&) Line | Count | Source | 252 | 273k | { | 253 | 273k | ::Serialize(*this, obj); | 254 | 273k | return (*this); | 255 | 273k | } |
DataStream& DataStream::operator<<<MuHash3072>(MuHash3072 const&) Line | Count | Source | 252 | 127 | { | 253 | 127 | ::Serialize(*this, obj); | 254 | 127 | return (*this); | 255 | 127 | } |
DataStream& DataStream::operator<<<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) Line | Count | Source | 252 | 121k | { | 253 | 121k | ::Serialize(*this, obj); | 254 | 121k | return (*this); | 255 | 121k | } |
DataStream& DataStream::operator<<<unsigned int>(unsigned int const&) Line | Count | Source | 252 | 55.8k | { | 253 | 55.8k | ::Serialize(*this, obj); | 254 | 55.8k | return (*this); | 255 | 55.8k | } |
DataStream& DataStream::operator<<<bool>(bool const&) Line | Count | Source | 252 | 46.7k | { | 253 | 46.7k | ::Serialize(*this, obj); | 254 | 46.7k | return (*this); | 255 | 46.7k | } |
DataStream& DataStream::operator<<<dbwrapper_tests::StringContentsSerializer>(dbwrapper_tests::StringContentsSerializer const&) Line | Count | Source | 252 | 102 | { | 253 | 102 | ::Serialize(*this, obj); | 254 | 102 | return (*this); | 255 | 102 | } |
DataStream& DataStream::operator<<<CPubKey>(CPubKey const&) Line | Count | Source | 252 | 12 | { | 253 | 12 | ::Serialize(*this, obj); | 254 | 12 | return (*this); | 255 | 12 | } |
DataStream& DataStream::operator<<<std::span<unsigned char const, 18446744073709551615ul>>(std::span<unsigned char const, 18446744073709551615ul> const&) Line | Count | Source | 252 | 183k | { | 253 | 183k | ::Serialize(*this, obj); | 254 | 183k | return (*this); | 255 | 183k | } |
DataStream& DataStream::operator<<<CMessageHeader>(CMessageHeader const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<ParamsWrapper<CAddress::SerParams, CNetAddr>>(ParamsWrapper<CAddress::SerParams, CNetAddr> const&) Line | Count | Source | 252 | 10 | { | 253 | 10 | ::Serialize(*this, obj); | 254 | 10 | return (*this); | 255 | 10 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 6ul>>(std::array<std::byte, 6ul> const&) Line | Count | Source | 252 | 3 | { | 253 | 3 | ::Serialize(*this, obj); | 254 | 3 | return (*this); | 255 | 3 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 4ul>>(std::array<std::byte, 4ul> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 8ul>>(std::array<std::byte, 8ul> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 18ul>>(std::array<std::byte, 18ul> const&) Line | Count | Source | 252 | 6 | { | 253 | 6 | ::Serialize(*this, obj); | 254 | 6 | return (*this); | 255 | 6 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 3ul>>(std::array<std::byte, 3ul> const&) Line | Count | Source | 252 | 4 | { | 253 | 4 | ::Serialize(*this, obj); | 254 | 4 | return (*this); | 255 | 4 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 12ul>>(std::array<std::byte, 12ul> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 34ul>>(std::array<std::byte, 34ul> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 13ul>>(std::array<std::byte, 13ul> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::array<std::byte, 2ul>>(std::array<std::byte, 2ul> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>> const>>(ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>> const> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<CPartialMerkleTree>(CPartialMerkleTree const&) Line | Count | Source | 252 | 168 | { | 253 | 168 | ::Serialize(*this, obj); | 254 | 168 | return (*this); | 255 | 168 | } |
DataStream& DataStream::operator<<<std::vector<int, std::allocator<int>>>(std::vector<int, std::allocator<int>> const&) Line | Count | Source | 252 | 268k | { | 253 | 268k | ::Serialize(*this, obj); | 254 | 268k | return (*this); | 255 | 268k | } |
DataStream& DataStream::operator<<<prevector<8u, int, unsigned int, int>>(prevector<8u, int, unsigned int, int> const&) Line | Count | Source | 252 | 268k | { | 253 | 268k | ::Serialize(*this, obj); | 254 | 268k | return (*this); | 255 | 268k | } |
DataStream& DataStream::operator<<<unsigned long>(unsigned long const&) Line | Count | Source | 252 | 100k | { | 253 | 100k | ::Serialize(*this, obj); | 254 | 100k | return (*this); | 255 | 100k | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)1>, int&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, int&> const&) Line | Count | Source | 252 | 100k | { | 253 | 100k | ::Serialize(*this, obj); | 254 | 100k | return (*this); | 255 | 100k | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)1>, signed char&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, signed char&> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned char&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned char&> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)1>, short&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, short&> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned short&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned short&> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&> const&) Line | Count | Source | 252 | 178k | { | 253 | 178k | ::Serialize(*this, obj); | 254 | 178k | return (*this); | 255 | 178k | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)1>, long long&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, long long&> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long long&> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::array<unsigned char, 32ul>>(std::array<unsigned char, 32ul> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<std::span<char const, 18446744073709551615ul>>(std::span<char const, 18446744073709551615ul> const&) Line | Count | Source | 252 | 8 | { | 253 | 8 | ::Serialize(*this, obj); | 254 | 8 | return (*this); | 255 | 8 | } |
DataStream& DataStream::operator<<<serialize_tests::CSerializeMethodsTestSingle>(serialize_tests::CSerializeMethodsTestSingle const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<serialize_tests::CSerializeMethodsTestMany>(serialize_tests::CSerializeMethodsTestMany const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<unsigned char [16]>(unsigned char const (&) [16]) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<ParamsWrapper<TransactionSerParams, CMutableTransaction>>(ParamsWrapper<TransactionSerParams, CMutableTransaction> const&) Line | Count | Source | 252 | 289 | { | 253 | 289 | ::Serialize(*this, obj); | 254 | 289 | return (*this); | 255 | 289 | } |
DataStream& DataStream::operator<<<std::byte>(std::byte const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<ParamsWrapper<serialize_tests::BaseFormat, serialize_tests::Base>>(ParamsWrapper<serialize_tests::BaseFormat, serialize_tests::Base> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<ParamsWrapper<serialize_tests::BaseFormat, std::vector<serialize_tests::Base, std::allocator<serialize_tests::Base>>>>(ParamsWrapper<serialize_tests::BaseFormat, std::vector<serialize_tests::Base, std::allocator<serialize_tests::Base>>> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<ParamsWrapper<serialize_tests::DerivedAndBaseFormat, serialize_tests::Derived>>(ParamsWrapper<serialize_tests::DerivedAndBaseFormat, serialize_tests::Derived> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<std::vector<std::byte, std::allocator<std::byte>>>(std::vector<std::byte, std::allocator<std::byte>> const&) Line | Count | Source | 252 | 515 | { | 253 | 515 | ::Serialize(*this, obj); | 254 | 515 | return (*this); | 255 | 515 | } |
DataStream& DataStream::operator<<<Obfuscation>(Obfuscation const&) Line | Count | Source | 252 | 514 | { | 253 | 514 | ::Serialize(*this, obj); | 254 | 514 | return (*this); | 255 | 514 | } |
DataStream& DataStream::operator<<<unsigned short>(unsigned short const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<uint160>(uint160 const&) Line | Count | Source | 252 | 3 | { | 253 | 3 | ::Serialize(*this, obj); | 254 | 3 | return (*this); | 255 | 3 | } |
DataStream& DataStream::operator<<<std::span<unsigned char const, 20ul>>(std::span<unsigned char const, 20ul> const&) Line | Count | Source | 252 | 3 | { | 253 | 3 | ::Serialize(*this, obj); | 254 | 3 | return (*this); | 255 | 3 | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int> const&) Line | Count | Source | 252 | 147 | { | 253 | 147 | ::Serialize(*this, obj); | 254 | 147 | return (*this); | 255 | 147 | } |
DataStream& DataStream::operator<<<std::span<std::byte const, 18446744073709551615ul>>(std::span<std::byte const, 18446744073709551615ul> const&) Line | Count | Source | 252 | 2.32k | { | 253 | 2.32k | ::Serialize(*this, obj); | 254 | 2.32k | return (*this); | 255 | 2.32k | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> const&) Line | Count | Source | 252 | 56.2k | { | 253 | 56.2k | ::Serialize(*this, obj); | 254 | 56.2k | return (*this); | 255 | 56.2k | } |
DataStream& DataStream::operator<<<PartiallySignedTransaction>(PartiallySignedTransaction const&) Line | Count | Source | 252 | 888 | { | 253 | 888 | ::Serialize(*this, obj); | 254 | 888 | return (*this); | 255 | 888 | } |
DataStream& DataStream::operator<<<unsigned char [5]>(unsigned char const (&) [5]) Line | Count | Source | 252 | 888 | { | 253 | 888 | ::Serialize(*this, obj); | 254 | 888 | return (*this); | 255 | 888 | } |
DataStream& DataStream::operator<<<unsigned char [4]>(unsigned char const (&) [4]) Line | Count | Source | 252 | 776 | { | 253 | 776 | ::Serialize(*this, obj); | 254 | 776 | return (*this); | 255 | 776 | } |
DataStream& DataStream::operator<<<PSBTInput>(PSBTInput const&) Line | Count | Source | 252 | 1.28k | { | 253 | 1.28k | ::Serialize(*this, obj); | 254 | 1.28k | return (*this); | 255 | 1.28k | } |
DataStream& DataStream::operator<<<CScript>(CScript const&) Line | Count | Source | 252 | 2.07k | { | 253 | 2.07k | ::Serialize(*this, obj); | 254 | 2.07k | return (*this); | 255 | 2.07k | } |
DataStream& DataStream::operator<<<PSBTOutput>(PSBTOutput const&) Line | Count | Source | 252 | 1.92k | { | 253 | 1.92k | ::Serialize(*this, obj); | 254 | 1.92k | return (*this); | 255 | 1.92k | } |
DataStream& DataStream::operator<<<CBlockHeader>(CBlockHeader const&) Line | Count | Source | 252 | 95.3k | { | 253 | 95.3k | ::Serialize(*this, obj); | 254 | 95.3k | return (*this); | 255 | 95.3k | } |
DataStream& DataStream::operator<<<CBlockLocator>(CBlockLocator const&) Line | Count | Source | 252 | 27.6k | { | 253 | 27.6k | ::Serialize(*this, obj); | 254 | 27.6k | return (*this); | 255 | 27.6k | } |
DataStream& DataStream::operator<<<index_util::DBHeightKey>(index_util::DBHeightKey const&) Line | Count | Source | 252 | 13.5k | { | 253 | 13.5k | ::Serialize(*this, obj); | 254 | 13.5k | return (*this); | 255 | 13.5k | } |
DataStream& DataStream::operator<<<index_util::DBHashKey>(index_util::DBHashKey const&) Line | Count | Source | 252 | 263 | { | 253 | 263 | ::Serialize(*this, obj); | 254 | 263 | return (*this); | 255 | 263 | } |
DataStream& DataStream::operator<<<FlatFilePos>(FlatFilePos const&) Line | Count | Source | 252 | 184 | { | 253 | 184 | ::Serialize(*this, obj); | 254 | 184 | return (*this); | 255 | 184 | } |
blockfilterindex.cpp:DataStream& DataStream::operator<<<std::pair<uint256, (anonymous namespace)::DBVal>>(std::pair<uint256, (anonymous namespace)::DBVal> const&) Line | Count | Source | 252 | 7.54k | { | 253 | 7.54k | ::Serialize(*this, obj); | 254 | 7.54k | return (*this); | 255 | 7.54k | } |
blockfilterindex.cpp:DataStream& DataStream::operator<<<(anonymous namespace)::DBVal>((anonymous namespace)::DBVal const&) Line | Count | Source | 252 | 111 | { | 253 | 111 | ::Serialize(*this, obj); | 254 | 111 | return (*this); | 255 | 111 | } |
coinstatsindex.cpp:DataStream& DataStream::operator<<<std::pair<uint256, (anonymous namespace)::DBVal>>(std::pair<uint256, (anonymous namespace)::DBVal> const&) Line | Count | Source | 252 | 3.86k | { | 253 | 3.86k | ::Serialize(*this, obj); | 254 | 3.86k | return (*this); | 255 | 3.86k | } |
coinstatsindex.cpp:DataStream& DataStream::operator<<<(anonymous namespace)::DBVal>((anonymous namespace)::DBVal const&) Line | Count | Source | 252 | 121 | { | 253 | 121 | ::Serialize(*this, obj); | 254 | 121 | return (*this); | 255 | 121 | } |
DataStream& DataStream::operator<<<std::pair<unsigned char, uint256>>(std::pair<unsigned char, uint256> const&) Line | Count | Source | 252 | 125k | { | 253 | 125k | ::Serialize(*this, obj); | 254 | 125k | return (*this); | 255 | 125k | } |
DataStream& DataStream::operator<<<CDiskTxPos>(CDiskTxPos const&) Line | Count | Source | 252 | 3.74k | { | 253 | 3.74k | ::Serialize(*this, obj); | 254 | 3.74k | return (*this); | 255 | 3.74k | } |
DataStream& DataStream::operator<<<char [12]>(char const (&) [12]) Line | Count | Source | 252 | 28 | { | 253 | 28 | ::Serialize(*this, obj); | 254 | 28 | return (*this); | 255 | 28 | } |
DataStream& DataStream::operator<<<std::pair<unsigned long, unsigned long>>(std::pair<unsigned long, unsigned long> const&) Line | Count | Source | 252 | 6 | { | 253 | 6 | ::Serialize(*this, obj); | 254 | 6 | return (*this); | 255 | 6 | } |
DataStream& DataStream::operator<<<DBKey>(DBKey const&) Line | Count | Source | 252 | 44 | { | 253 | 44 | ::Serialize(*this, obj); | 254 | 44 | return (*this); | 255 | 44 | } |
DataStream& DataStream::operator<<<char [1]>(char const (&) [1]) Line | Count | Source | 252 | 38 | { | 253 | 38 | ::Serialize(*this, obj); | 254 | 38 | return (*this); | 255 | 38 | } |
DataStream& DataStream::operator<<<std::pair<unsigned char, unsigned long>>(std::pair<unsigned char, unsigned long> const&) Line | Count | Source | 252 | 35 | { | 253 | 35 | ::Serialize(*this, obj); | 254 | 35 | return (*this); | 255 | 35 | } |
DataStream& DataStream::operator<<<COutPoint>(COutPoint const&) Line | Count | Source | 252 | 5.97k | { | 253 | 5.97k | ::Serialize(*this, obj); | 254 | 5.97k | return (*this); | 255 | 5.97k | } |
DataStream& DataStream::operator<<<CTxOut>(CTxOut const&) Line | Count | Source | 252 | 5.86k | { | 253 | 5.86k | ::Serialize(*this, obj); | 254 | 5.86k | return (*this); | 255 | 5.86k | } |
DataStream& DataStream::operator<<<std::pair<unsigned char, int>>(std::pair<unsigned char, int> const&) Line | Count | Source | 252 | 4.01k | { | 253 | 4.01k | ::Serialize(*this, obj); | 254 | 4.01k | return (*this); | 255 | 4.01k | } |
DataStream& DataStream::operator<<<kernel::CBlockFileInfo>(kernel::CBlockFileInfo const&) Line | Count | Source | 252 | 1.63k | { | 253 | 1.63k | ::Serialize(*this, obj); | 254 | 1.63k | return (*this); | 255 | 1.63k | } |
DataStream& DataStream::operator<<<CDiskBlockIndex>(CDiskBlockIndex const&) Line | Count | Source | 252 | 118k | { | 253 | 118k | ::Serialize(*this, obj); | 254 | 118k | return (*this); | 255 | 118k | } |
DataStream& DataStream::operator<<<std::pair<unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>(std::pair<unsigned char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>> const&) Line | Count | Source | 252 | 1.19k | { | 253 | 1.19k | ::Serialize(*this, obj); | 254 | 1.19k | return (*this); | 255 | 1.19k | } |
DataStream& DataStream::operator<<<ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const> const>>(ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const> const> const&) Line | Count | Source | 252 | 23.3k | { | 253 | 23.3k | ::Serialize(*this, obj); | 254 | 23.3k | return (*this); | 255 | 23.3k | } |
DataStream& DataStream::operator<<<std::vector<CCoin, std::allocator<CCoin>>>(std::vector<CCoin, std::allocator<CCoin>> const&) Line | Count | Source | 252 | 1 | { | 253 | 1 | ::Serialize(*this, obj); | 254 | 1 | return (*this); | 255 | 1 | } |
DataStream& DataStream::operator<<<ParamsWrapper<TransactionSerParams, CBlock const>>(ParamsWrapper<TransactionSerParams, CBlock const> const&) Line | Count | Source | 252 | 5 | { | 253 | 5 | ::Serialize(*this, obj); | 254 | 5 | return (*this); | 255 | 5 | } |
txdb.cpp:DataStream& DataStream::operator<<<(anonymous namespace)::CoinEntry>((anonymous namespace)::CoinEntry const&) Line | Count | Source | 252 | 6.53M | { | 253 | 6.53M | ::Serialize(*this, obj); | 254 | 6.53M | return (*this); | 255 | 6.53M | } |
DataStream& DataStream::operator<<<std::vector<uint256, std::allocator<uint256>>>(std::vector<uint256, std::allocator<uint256>> const&) Line | Count | Source | 252 | 3.74k | { | 253 | 3.74k | ::Serialize(*this, obj); | 254 | 3.74k | return (*this); | 255 | 3.74k | } |
DataStream& DataStream::operator<<<Coin>(Coin const&) Line | Count | Source | 252 | 272k | { | 253 | 272k | ::Serialize(*this, obj); | 254 | 272k | return (*this); | 255 | 272k | } |
DataStream& DataStream::operator<<<std::span<unsigned char, 18446744073709551615ul>>(std::span<unsigned char, 18446744073709551615ul> const&) Line | Count | Source | 252 | 95.0k | { | 253 | 95.0k | ::Serialize(*this, obj); | 254 | 95.0k | return (*this); | 255 | 95.0k | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, transaction_identifier<false>>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, transaction_identifier<false>> const&) Line | Count | Source | 252 | 23.3k | { | 253 | 23.3k | ::Serialize(*this, obj); | 254 | 23.3k | return (*this); | 255 | 23.3k | } |
DataStream& DataStream::operator<<<wallet::CWalletTx>(wallet::CWalletTx const&) Line | Count | Source | 252 | 23.3k | { | 253 | 23.3k | ::Serialize(*this, obj); | 254 | 23.3k | return (*this); | 255 | 23.3k | } |
DataStream& DataStream::operator<<<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&) Line | Count | Source | 252 | 23.3k | { | 253 | 23.3k | ::Serialize(*this, obj); | 254 | 23.3k | return (*this); | 255 | 23.3k | } |
DataStream& DataStream::operator<<<std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&) Line | Count | Source | 252 | 23.3k | { | 253 | 23.3k | ::Serialize(*this, obj); | 254 | 23.3k | return (*this); | 255 | 23.3k | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, uint256>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, uint256> const&) Line | Count | Source | 252 | 101k | { | 253 | 101k | ::Serialize(*this, obj); | 254 | 101k | return (*this); | 255 | 101k | } |
Unexecuted instantiation: DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CPubKey>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CPubKey> const&) Unexecuted instantiation: DataStream& DataStream::operator<<<wallet::CKeyMetadata>(wallet::CKeyMetadata const&) DataStream& DataStream::operator<<<std::pair<std::vector<unsigned char, secure_allocator<unsigned char>>, uint256>>(std::pair<std::vector<unsigned char, secure_allocator<unsigned char>>, uint256> const&) Line | Count | Source | 252 | 4.29k | { | 253 | 4.29k | ::Serialize(*this, obj); | 254 | 4.29k | return (*this); | 255 | 4.29k | } |
Unexecuted instantiation: DataStream& DataStream::operator<<<std::pair<std::vector<unsigned char, std::allocator<unsigned char>>, uint256>>(std::pair<std::vector<unsigned char, std::allocator<unsigned char>>, uint256> const&) DataStream& DataStream::operator<<<wallet::CMasterKey>(wallet::CMasterKey const&) Line | Count | Source | 252 | 26 | { | 253 | 26 | ::Serialize(*this, obj); | 254 | 26 | return (*this); | 255 | 26 | } |
Unexecuted instantiation: DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CScript>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CScript> const&) DataStream& DataStream::operator<<<long>(long const&) Line | Count | Source | 252 | 17.7k | { | 253 | 17.7k | ::Serialize(*this, obj); | 254 | 17.7k | return (*this); | 255 | 17.7k | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned char>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned char> const&) Line | Count | Source | 252 | 4.08k | { | 253 | 4.08k | ::Serialize(*this, obj); | 254 | 4.08k | return (*this); | 255 | 4.08k | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<uint256, CPubKey>>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<uint256, CPubKey>> const&) Line | Count | Source | 252 | 4.82k | { | 253 | 4.82k | ::Serialize(*this, obj); | 254 | 4.82k | return (*this); | 255 | 4.82k | } |
DataStream& DataStream::operator<<<wallet::WalletDescriptor>(wallet::WalletDescriptor const&) Line | Count | Source | 252 | 101k | { | 253 | 101k | ::Serialize(*this, obj); | 254 | 101k | return (*this); | 255 | 101k | } |
DataStream& DataStream::operator<<<std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, uint256>, std::pair<unsigned int, unsigned int>>>(std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, uint256>, std::pair<unsigned int, unsigned int>> const&) Line | Count | Source | 252 | 10.0k | { | 253 | 10.0k | ::Serialize(*this, obj); | 254 | 10.0k | return (*this); | 255 | 10.0k | } |
DataStream& DataStream::operator<<<std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, uint256>, unsigned int>>(std::pair<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, uint256>, unsigned int> const&) Line | Count | Source | 252 | 8.98k | { | 253 | 8.98k | ::Serialize(*this, obj); | 254 | 8.98k | return (*this); | 255 | 8.98k | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<transaction_identifier<false>, unsigned int>>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<transaction_identifier<false>, unsigned int>> const&) Line | Count | Source | 252 | 2 | { | 253 | 2 | ::Serialize(*this, obj); | 254 | 2 | return (*this); | 255 | 2 | } |
DataStream& DataStream::operator<<<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) Line | Count | Source | 252 | 29 | { | 253 | 29 | ::Serialize(*this, obj); | 254 | 29 | return (*this); | 255 | 29 | } |
DataStream& DataStream::operator<<<ParamsWrapper<TransactionSerParams, CTransaction const>>(ParamsWrapper<TransactionSerParams, CTransaction const> const&) Line | Count | Source | 252 | 5.88k | { | 253 | 5.88k | ::Serialize(*this, obj); | 254 | 5.88k | return (*this); | 255 | 5.88k | } |
|
256 | | |
257 | | template <typename T> |
258 | | DataStream& operator>>(T&& obj) |
259 | 2.18M | { |
260 | 2.18M | ::Unserialize(*this, obj); |
261 | 2.18M | return (*this); |
262 | 2.18M | } DataStream& DataStream::operator>><AddrMan&>(AddrMan&) Line | Count | Source | 259 | 7 | { | 260 | 7 | ::Unserialize(*this, obj); | 261 | 7 | return (*this); | 262 | 7 | } |
DataStream& DataStream::operator>><unsigned char (&) [4]>(unsigned char (&) [4]) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><blockencodings_tests::TestHeaderAndShortIDs&>(blockencodings_tests::TestHeaderAndShortIDs&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><CBlockHeaderAndShortTxIDs&>(CBlockHeaderAndShortTxIDs&) Line | Count | Source | 259 | 20.3k | { | 260 | 20.3k | ::Unserialize(*this, obj); | 261 | 20.3k | return (*this); | 262 | 20.3k | } |
DataStream& DataStream::operator>><BlockTransactionsRequest&>(BlockTransactionsRequest&) Line | Count | Source | 259 | 619 | { | 260 | 619 | ::Unserialize(*this, obj); | 261 | 619 | return (*this); | 262 | 619 | } |
DataStream& DataStream::operator>><BlockFilter&>(BlockFilter&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><unsigned char&>(unsigned char&) Line | Count | Source | 259 | 2.23k | { | 260 | 2.23k | ::Unserialize(*this, obj); | 261 | 2.23k | return (*this); | 262 | 2.23k | } |
DataStream& DataStream::operator>><uint256&>(uint256&) Line | Count | Source | 259 | 24.2k | { | 260 | 24.2k | ::Unserialize(*this, obj); | 261 | 24.2k | return (*this); | 262 | 24.2k | } |
DataStream& DataStream::operator>><std::vector<unsigned char, std::allocator<unsigned char>>&>(std::vector<unsigned char, std::allocator<unsigned char>>&) Line | Count | Source | 259 | 4.82k | { | 260 | 4.82k | ::Unserialize(*this, obj); | 261 | 4.82k | return (*this); | 262 | 4.82k | } |
DataStream& DataStream::operator>><unsigned int&>(unsigned int&) Line | Count | Source | 259 | 23.5k | { | 260 | 23.5k | ::Unserialize(*this, obj); | 261 | 23.5k | return (*this); | 262 | 23.5k | } |
DataStream& DataStream::operator>><std::vector<CTxIn, std::allocator<CTxIn>>&>(std::vector<CTxIn, std::allocator<CTxIn>>&) Line | Count | Source | 259 | 263 | { | 260 | 263 | ::Unserialize(*this, obj); | 261 | 263 | return (*this); | 262 | 263 | } |
DataStream& DataStream::operator>><std::vector<CTxOut, std::allocator<CTxOut>>&>(std::vector<CTxOut, std::allocator<CTxOut>>&) Line | Count | Source | 259 | 219 | { | 260 | 219 | ::Unserialize(*this, obj); | 261 | 219 | return (*this); | 262 | 219 | } |
DataStream& DataStream::operator>><std::vector<std::vector<unsigned char, std::allocator<unsigned char>>, std::allocator<std::vector<unsigned char, std::allocator<unsigned char>>>>&>(std::vector<std::vector<unsigned char, std::allocator<unsigned char>>, std::allocator<std::vector<unsigned char, std::allocator<unsigned char>>>>&) Line | Count | Source | 259 | 4.59k | { | 260 | 4.59k | ::Unserialize(*this, obj); | 261 | 4.59k | return (*this); | 262 | 4.59k | } |
DataStream& DataStream::operator>><ParamsWrapper<TransactionSerParams, CBlock>>(ParamsWrapper<TransactionSerParams, CBlock>&&) Line | Count | Source | 259 | 37.1k | { | 260 | 37.1k | ::Unserialize(*this, obj); | 261 | 37.1k | return (*this); | 262 | 37.1k | } |
DataStream& DataStream::operator>><MuHash3072&>(MuHash3072&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><std::pair<uint256, unsigned char>&>(std::pair<uint256, unsigned char>&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><CPubKey&>(CPubKey&) Line | Count | Source | 259 | 2.88k | { | 260 | 2.88k | ::Unserialize(*this, obj); | 261 | 2.88k | return (*this); | 262 | 2.88k | } |
DataStream& DataStream::operator>><std::span<unsigned char, 18446744073709551615ul>>(std::span<unsigned char, 18446744073709551615ul>&&) Line | Count | Source | 259 | 227k | { | 260 | 227k | ::Unserialize(*this, obj); | 261 | 227k | return (*this); | 262 | 227k | } |
DataStream& DataStream::operator>><ParamsWrapper<CAddress::SerParams, CNetAddr>>(ParamsWrapper<CAddress::SerParams, CNetAddr>&&) Line | Count | Source | 259 | 20 | { | 260 | 20 | ::Unserialize(*this, obj); | 261 | 20 | return (*this); | 262 | 20 | } |
DataStream& DataStream::operator>><CPartialMerkleTreeTester&>(CPartialMerkleTreeTester&) Line | Count | Source | 259 | 168 | { | 260 | 168 | ::Unserialize(*this, obj); | 261 | 168 | return (*this); | 262 | 168 | } |
DataStream& DataStream::operator>><unsigned long&>(unsigned long&) Line | Count | Source | 259 | 14.2k | { | 260 | 14.2k | ::Unserialize(*this, obj); | 261 | 14.2k | return (*this); | 262 | 14.2k | } |
DataStream& DataStream::operator>><Wrapper<VarIntFormatter<(VarIntMode)1>, int&>>(Wrapper<VarIntFormatter<(VarIntMode)1>, int&>&&) Line | Count | Source | 259 | 100k | { | 260 | 100k | ::Unserialize(*this, obj); | 261 | 100k | return (*this); | 262 | 100k | } |
DataStream& DataStream::operator>><Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>&&) Line | Count | Source | 259 | 225k | { | 260 | 225k | ::Unserialize(*this, obj); | 261 | 225k | return (*this); | 262 | 225k | } |
DataStream& DataStream::operator>><std::array<unsigned char, 32ul>&>(std::array<unsigned char, 32ul>&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><serialize_tests::CSerializeMethodsTestMany&>(serialize_tests::CSerializeMethodsTestMany&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><serialize_tests::CSerializeMethodsTestSingle&>(serialize_tests::CSerializeMethodsTestSingle&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><std::span<std::byte, 2ul>>(std::span<std::byte, 2ul>&&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><std::byte&>(std::byte&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><ParamsWrapper<serialize_tests::BaseFormat, serialize_tests::Base>>(ParamsWrapper<serialize_tests::BaseFormat, serialize_tests::Base>&&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><ParamsWrapper<serialize_tests::BaseFormat, std::vector<serialize_tests::Base, std::allocator<serialize_tests::Base>>>>(ParamsWrapper<serialize_tests::BaseFormat, std::vector<serialize_tests::Base, std::allocator<serialize_tests::Base>>>&&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><Obfuscation&>(Obfuscation&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><std::vector<std::byte, std::allocator<std::byte>>&>(std::vector<std::byte, std::allocator<std::byte>>&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><unsigned short&>(unsigned short&) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const>>>(ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const>>&&) Line | Count | Source | 259 | 23.7k | { | 260 | 23.7k | ::Unserialize(*this, obj); | 261 | 23.7k | return (*this); | 262 | 23.7k | } |
DataStream& DataStream::operator>><ParamsWrapper<TransactionSerParams, CMutableTransaction>>(ParamsWrapper<TransactionSerParams, CMutableTransaction>&&) Line | Count | Source | 259 | 24 | { | 260 | 24 | ::Unserialize(*this, obj); | 261 | 24 | return (*this); | 262 | 24 | } |
DataStream& DataStream::operator>><uint160&>(uint160&) Line | Count | Source | 259 | 89 | { | 260 | 89 | ::Unserialize(*this, obj); | 261 | 89 | return (*this); | 262 | 89 | } |
DataStream& DataStream::operator>><std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) Line | Count | Source | 259 | 33.2k | { | 260 | 33.2k | ::Unserialize(*this, obj); | 261 | 33.2k | return (*this); | 262 | 33.2k | } |
DataStream& DataStream::operator>><unsigned char (&) [5]>(unsigned char (&) [5]) Line | Count | Source | 259 | 1 | { | 260 | 1 | ::Unserialize(*this, obj); | 261 | 1 | return (*this); | 262 | 1 | } |
DataStream& DataStream::operator>><PSBTInput&>(PSBTInput&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><CScript&>(CScript&) Line | Count | Source | 259 | 182 | { | 260 | 182 | ::Unserialize(*this, obj); | 261 | 182 | return (*this); | 262 | 182 | } |
Unexecuted instantiation: DataStream& DataStream::operator>><std::set<uint256, std::less<uint256>, std::allocator<uint256>>&>(std::set<uint256, std::less<uint256>, std::allocator<uint256>>&) DataStream& DataStream::operator>><PSBTOutput&>(PSBTOutput&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><Wrapper<CustomUintFormatter<1, false>, AddrManImpl::Format&>>(Wrapper<CustomUintFormatter<1, false>, AddrManImpl::Format&>&&) Line | Count | Source | 259 | 7 | { | 260 | 7 | ::Unserialize(*this, obj); | 261 | 7 | return (*this); | 262 | 7 | } |
blockfilterindex.cpp:DataStream& DataStream::operator>><std::pair<uint256, (anonymous namespace)::DBVal>&>(std::pair<uint256, (anonymous namespace)::DBVal>&) Line | Count | Source | 259 | 2.97k | { | 260 | 2.97k | ::Unserialize(*this, obj); | 261 | 2.97k | return (*this); | 262 | 2.97k | } |
coinstatsindex.cpp:DataStream& DataStream::operator>><std::pair<uint256, (anonymous namespace)::DBVal>&>(std::pair<uint256, (anonymous namespace)::DBVal>&) Line | Count | Source | 259 | 121 | { | 260 | 121 | ::Unserialize(*this, obj); | 261 | 121 | return (*this); | 262 | 121 | } |
DataStream& DataStream::operator>><CMessageHeader&>(CMessageHeader&) Line | Count | Source | 259 | 151k | { | 260 | 151k | ::Unserialize(*this, obj); | 261 | 151k | return (*this); | 262 | 151k | } |
DataStream& DataStream::operator>><int&>(int&) Line | Count | Source | 259 | 11.1k | { | 260 | 11.1k | ::Unserialize(*this, obj); | 261 | 11.1k | return (*this); | 262 | 11.1k | } |
DataStream& DataStream::operator>><Wrapper<CustomUintFormatter<8, false>, ServiceFlags&>>(Wrapper<CustomUintFormatter<8, false>, ServiceFlags&>&&) Line | Count | Source | 259 | 1.54k | { | 260 | 1.54k | ::Unserialize(*this, obj); | 261 | 1.54k | return (*this); | 262 | 1.54k | } |
DataStream& DataStream::operator>><long&>(long&) Line | Count | Source | 259 | 2.70k | { | 260 | 2.70k | ::Unserialize(*this, obj); | 261 | 2.70k | return (*this); | 262 | 2.70k | } |
DataStream& DataStream::operator>><ParamsWrapper<CNetAddr::SerParams, CService>>(ParamsWrapper<CNetAddr::SerParams, CService>&&) Line | Count | Source | 259 | 1.54k | { | 260 | 1.54k | ::Unserialize(*this, obj); | 261 | 1.54k | return (*this); | 262 | 1.54k | } |
DataStream& DataStream::operator>><Wrapper<LimitedStringFormatter<256ul>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>>(Wrapper<LimitedStringFormatter<256ul>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>&&) Line | Count | Source | 259 | 1.52k | { | 260 | 1.52k | ::Unserialize(*this, obj); | 261 | 1.52k | return (*this); | 262 | 1.52k | } |
DataStream& DataStream::operator>><bool&>(bool&) Line | Count | Source | 259 | 18.1k | { | 260 | 18.1k | ::Unserialize(*this, obj); | 261 | 18.1k | return (*this); | 262 | 18.1k | } |
DataStream& DataStream::operator>><ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>>>>(ParamsWrapper<CAddress::SerParams, std::vector<CAddress, std::allocator<CAddress>>>&&) Line | Count | Source | 259 | 59 | { | 260 | 59 | ::Unserialize(*this, obj); | 261 | 59 | return (*this); | 262 | 59 | } |
DataStream& DataStream::operator>><std::vector<CInv, std::allocator<CInv>>&>(std::vector<CInv, std::allocator<CInv>>&) Line | Count | Source | 259 | 56.4k | { | 260 | 56.4k | ::Unserialize(*this, obj); | 261 | 56.4k | return (*this); | 262 | 56.4k | } |
DataStream& DataStream::operator>><CBlockLocator&>(CBlockLocator&) Line | Count | Source | 259 | 6.07k | { | 260 | 6.07k | ::Unserialize(*this, obj); | 261 | 6.07k | return (*this); | 262 | 6.07k | } |
DataStream& DataStream::operator>><BlockTransactions&>(BlockTransactions&) Line | Count | Source | 259 | 598 | { | 260 | 598 | ::Unserialize(*this, obj); | 261 | 598 | return (*this); | 262 | 598 | } |
DataStream& DataStream::operator>><CBlockHeader&>(CBlockHeader&) Line | Count | Source | 259 | 552k | { | 260 | 552k | ::Unserialize(*this, obj); | 261 | 552k | return (*this); | 262 | 552k | } |
DataStream& DataStream::operator>><CBloomFilter&>(CBloomFilter&) Line | Count | Source | 259 | 9 | { | 260 | 9 | ::Unserialize(*this, obj); | 261 | 9 | return (*this); | 262 | 9 | } |
DataStream& DataStream::operator>><CDiskBlockIndex&>(CDiskBlockIndex&) Line | Count | Source | 259 | 133k | { | 260 | 133k | ::Unserialize(*this, obj); | 261 | 133k | return (*this); | 262 | 133k | } |
DataStream& DataStream::operator>><std::vector<COutPoint, std::allocator<COutPoint>>&>(std::vector<COutPoint, std::allocator<COutPoint>>&) Line | Count | Source | 259 | 2 | { | 260 | 2 | ::Unserialize(*this, obj); | 261 | 2 | return (*this); | 262 | 2 | } |
DataStream& DataStream::operator>><Coin&>(Coin&) Line | Count | Source | 259 | 224k | { | 260 | 224k | ::Unserialize(*this, obj); | 261 | 224k | return (*this); | 262 | 224k | } |
DataStream& DataStream::operator>><Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>&&) Line | Count | Source | 259 | 224k | { | 260 | 224k | ::Unserialize(*this, obj); | 261 | 224k | return (*this); | 262 | 224k | } |
DataStream& DataStream::operator>><wallet::CKeyMetadata&>(wallet::CKeyMetadata&) Line | Count | Source | 259 | 267 | { | 260 | 267 | ::Unserialize(*this, obj); | 261 | 267 | return (*this); | 262 | 267 | } |
DataStream& DataStream::operator>><wallet::WalletDescriptor&>(wallet::WalletDescriptor&) Line | Count | Source | 259 | 2.52k | { | 260 | 2.52k | ::Unserialize(*this, obj); | 261 | 2.52k | return (*this); | 262 | 2.52k | } |
DataStream& DataStream::operator>><transaction_identifier<false>&>(transaction_identifier<false>&) Line | Count | Source | 259 | 7.73k | { | 260 | 7.73k | ::Unserialize(*this, obj); | 261 | 7.73k | return (*this); | 262 | 7.73k | } |
DataStream& DataStream::operator>><wallet::CWalletTx&>(wallet::CWalletTx&) Line | Count | Source | 259 | 7.72k | { | 260 | 7.72k | ::Unserialize(*this, obj); | 261 | 7.72k | return (*this); | 262 | 7.72k | } |
DataStream& DataStream::operator>><std::vector<uint256, std::allocator<uint256>>&>(std::vector<uint256, std::allocator<uint256>>&) Line | Count | Source | 259 | 7.72k | { | 260 | 7.72k | ::Unserialize(*this, obj); | 261 | 7.72k | return (*this); | 262 | 7.72k | } |
DataStream& DataStream::operator>><std::vector<wallet::CMerkleTx, std::allocator<wallet::CMerkleTx>>&>(std::vector<wallet::CMerkleTx, std::allocator<wallet::CMerkleTx>>&) Line | Count | Source | 259 | 7.72k | { | 260 | 7.72k | ::Unserialize(*this, obj); | 261 | 7.72k | return (*this); | 262 | 7.72k | } |
DataStream& DataStream::operator>><std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&>(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&) Line | Count | Source | 259 | 7.72k | { | 260 | 7.72k | ::Unserialize(*this, obj); | 261 | 7.72k | return (*this); | 262 | 7.72k | } |
DataStream& DataStream::operator>><std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&>(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&) Line | Count | Source | 259 | 7.72k | { | 260 | 7.72k | ::Unserialize(*this, obj); | 261 | 7.72k | return (*this); | 262 | 7.72k | } |
DataStream& DataStream::operator>><std::vector<unsigned char, secure_allocator<unsigned char>>&>(std::vector<unsigned char, secure_allocator<unsigned char>>&) Line | Count | Source | 259 | 2.42k | { | 260 | 2.42k | ::Unserialize(*this, obj); | 261 | 2.42k | return (*this); | 262 | 2.42k | } |
DataStream& DataStream::operator>><wallet::CMasterKey&>(wallet::CMasterKey&) Line | Count | Source | 259 | 17 | { | 260 | 17 | ::Unserialize(*this, obj); | 261 | 17 | return (*this); | 262 | 17 | } |
DataStream& DataStream::operator>><wallet::CHDChain&>(wallet::CHDChain&) Line | Count | Source | 259 | 32 | { | 260 | 32 | ::Unserialize(*this, obj); | 261 | 32 | return (*this); | 262 | 32 | } |
|
263 | | |
264 | | /** Compute total memory usage of this object (own memory + any dynamic memory). */ |
265 | | size_t GetMemoryUsage() const noexcept; |
266 | | }; |
267 | | |
268 | | // Require empty scratch streams on entry and reset them on exit. |
269 | | class ScopedDataStreamUsage |
270 | | { |
271 | | DataStream& m_stream; |
272 | | |
273 | | public: |
274 | 1.24M | explicit ScopedDataStreamUsage(DataStream& stream) : m_stream{stream} { assert(m_stream.empty()); } |
275 | | |
276 | | ScopedDataStreamUsage(const ScopedDataStreamUsage&) = delete; |
277 | | ScopedDataStreamUsage& operator=(const ScopedDataStreamUsage&) = delete; |
278 | | |
279 | 1.24M | ~ScopedDataStreamUsage() { m_stream.clear(); } |
280 | | }; |
281 | | |
282 | | template <typename IStream> |
283 | | class BitStreamReader |
284 | | { |
285 | | private: |
286 | | IStream& m_istream; |
287 | | |
288 | | /// Buffered byte read in from the input stream. A new byte is read into the |
289 | | /// buffer when m_offset reaches 8. |
290 | | uint8_t m_buffer{0}; |
291 | | |
292 | | /// Number of high order bits in m_buffer already returned by previous |
293 | | /// Read() calls. The next bit to be returned is at this offset from the |
294 | | /// most significant bit position. |
295 | | int m_offset{8}; |
296 | | |
297 | | public: |
298 | 1.24k | explicit BitStreamReader(IStream& istream) : m_istream(istream) {}BitStreamReader<DataStream>::BitStreamReader(DataStream&) Line | Count | Source | 298 | 1 | explicit BitStreamReader(IStream& istream) : m_istream(istream) {} |
BitStreamReader<SpanReader>::BitStreamReader(SpanReader&) Line | Count | Source | 298 | 1.24k | explicit BitStreamReader(IStream& istream) : m_istream(istream) {} |
|
299 | | |
300 | | /** Read the specified number of bits from the stream. The data is returned |
301 | | * in the nbits least significant bits of a 64-bit uint. |
302 | | */ |
303 | 24.5k | uint64_t Read(int nbits) { |
304 | 24.5k | if (nbits < 0 || nbits > 64) { |
305 | 0 | throw std::out_of_range("nbits must be between 0 and 64"); |
306 | 0 | } |
307 | | |
308 | 24.5k | uint64_t data = 0; |
309 | 61.6k | while (nbits > 0) { |
310 | 37.0k | if (m_offset == 8) { |
311 | 16.0k | m_istream >> m_buffer; |
312 | 16.0k | m_offset = 0; |
313 | 16.0k | } |
314 | | |
315 | 37.0k | int bits = std::min(8 - m_offset, nbits); |
316 | 37.0k | data <<= bits; |
317 | 37.0k | data |= static_cast<uint8_t>(m_buffer << m_offset) >> (8 - bits); |
318 | 37.0k | m_offset += bits; |
319 | 37.0k | nbits -= bits; |
320 | 37.0k | } |
321 | 24.5k | return data; |
322 | 24.5k | } BitStreamReader<DataStream>::Read(int) Line | Count | Source | 303 | 9 | uint64_t Read(int nbits) { | 304 | 9 | if (nbits < 0 || nbits > 64) { | 305 | 0 | throw std::out_of_range("nbits must be between 0 and 64"); | 306 | 0 | } | 307 | | | 308 | 9 | uint64_t data = 0; | 309 | 24 | while (nbits > 0) { | 310 | 15 | if (m_offset == 8) { | 311 | 7 | m_istream >> m_buffer; | 312 | 7 | m_offset = 0; | 313 | 7 | } | 314 | | | 315 | 15 | int bits = std::min(8 - m_offset, nbits); | 316 | 15 | data <<= bits; | 317 | 15 | data |= static_cast<uint8_t>(m_buffer << m_offset) >> (8 - bits); | 318 | 15 | m_offset += bits; | 319 | 15 | nbits -= bits; | 320 | 15 | } | 321 | 9 | return data; | 322 | 9 | } |
BitStreamReader<SpanReader>::Read(int) Line | Count | Source | 303 | 24.5k | uint64_t Read(int nbits) { | 304 | 24.5k | if (nbits < 0 || nbits > 64) { | 305 | 0 | throw std::out_of_range("nbits must be between 0 and 64"); | 306 | 0 | } | 307 | | | 308 | 24.5k | uint64_t data = 0; | 309 | 61.6k | while (nbits > 0) { | 310 | 37.0k | if (m_offset == 8) { | 311 | 16.0k | m_istream >> m_buffer; | 312 | 16.0k | m_offset = 0; | 313 | 16.0k | } | 314 | | | 315 | 37.0k | int bits = std::min(8 - m_offset, nbits); | 316 | 37.0k | data <<= bits; | 317 | 37.0k | data |= static_cast<uint8_t>(m_buffer << m_offset) >> (8 - bits); | 318 | 37.0k | m_offset += bits; | 319 | 37.0k | nbits -= bits; | 320 | 37.0k | } | 321 | 24.5k | return data; | 322 | 24.5k | } |
|
323 | | }; |
324 | | |
325 | | template <typename OStream> |
326 | | class BitStreamWriter |
327 | | { |
328 | | private: |
329 | | OStream& m_ostream; |
330 | | |
331 | | /// Buffered byte waiting to be written to the output stream. The byte is |
332 | | /// written buffer when m_offset reaches 8 or Flush() is called. |
333 | | uint8_t m_buffer{0}; |
334 | | |
335 | | /// Number of high order bits in m_buffer already written by previous |
336 | | /// Write() calls and not yet flushed to the stream. The next bit to be |
337 | | /// written to is at this offset from the most significant bit position. |
338 | | int m_offset{0}; |
339 | | |
340 | | public: |
341 | 7.67k | explicit BitStreamWriter(OStream& ostream) : m_ostream(ostream) {}BitStreamWriter<DataStream>::BitStreamWriter(DataStream&) Line | Count | Source | 341 | 1 | explicit BitStreamWriter(OStream& ostream) : m_ostream(ostream) {} |
BitStreamWriter<VectorWriter>::BitStreamWriter(VectorWriter&) Line | Count | Source | 341 | 7.67k | explicit BitStreamWriter(OStream& ostream) : m_ostream(ostream) {} |
|
342 | | |
343 | | ~BitStreamWriter() |
344 | 7.67k | { |
345 | 7.67k | Flush(); |
346 | 7.67k | } BitStreamWriter<DataStream>::~BitStreamWriter() Line | Count | Source | 344 | 1 | { | 345 | 1 | Flush(); | 346 | 1 | } |
BitStreamWriter<VectorWriter>::~BitStreamWriter() Line | Count | Source | 344 | 7.67k | { | 345 | 7.67k | Flush(); | 346 | 7.67k | } |
|
347 | | |
348 | | /** Write the nbits least significant bits of a 64-bit int to the output |
349 | | * stream. Data is buffered until it completes an octet. |
350 | | */ |
351 | 18.8k | void Write(uint64_t data, int nbits) { |
352 | 18.8k | if (nbits < 0 || nbits > 64) { |
353 | 0 | throw std::out_of_range("nbits must be between 0 and 64"); |
354 | 0 | } |
355 | | |
356 | 54.1k | while (nbits > 0) { |
357 | 35.2k | int bits = std::min(8 - m_offset, nbits); |
358 | 35.2k | m_buffer |= (data << (64 - nbits)) >> (64 - 8 + m_offset); |
359 | 35.2k | m_offset += bits; |
360 | 35.2k | nbits -= bits; |
361 | | |
362 | 35.2k | if (m_offset == 8) { |
363 | 16.4k | Flush(); |
364 | 16.4k | } |
365 | 35.2k | } |
366 | 18.8k | } BitStreamWriter<DataStream>::Write(unsigned long, int) Line | Count | Source | 351 | 8 | void Write(uint64_t data, int nbits) { | 352 | 8 | if (nbits < 0 || nbits > 64) { | 353 | 0 | throw std::out_of_range("nbits must be between 0 and 64"); | 354 | 0 | } | 355 | | | 356 | 21 | while (nbits > 0) { | 357 | 13 | int bits = std::min(8 - m_offset, nbits); | 358 | 13 | m_buffer |= (data << (64 - nbits)) >> (64 - 8 + m_offset); | 359 | 13 | m_offset += bits; | 360 | 13 | nbits -= bits; | 361 | | | 362 | 13 | if (m_offset == 8) { | 363 | 5 | Flush(); | 364 | 5 | } | 365 | 13 | } | 366 | 8 | } |
BitStreamWriter<VectorWriter>::Write(unsigned long, int) Line | Count | Source | 351 | 18.8k | void Write(uint64_t data, int nbits) { | 352 | 18.8k | if (nbits < 0 || nbits > 64) { | 353 | 0 | throw std::out_of_range("nbits must be between 0 and 64"); | 354 | 0 | } | 355 | | | 356 | 54.1k | while (nbits > 0) { | 357 | 35.2k | int bits = std::min(8 - m_offset, nbits); | 358 | 35.2k | m_buffer |= (data << (64 - nbits)) >> (64 - 8 + m_offset); | 359 | 35.2k | m_offset += bits; | 360 | 35.2k | nbits -= bits; | 361 | | | 362 | 35.2k | if (m_offset == 8) { | 363 | 16.4k | Flush(); | 364 | 16.4k | } | 365 | 35.2k | } | 366 | 18.8k | } |
|
367 | | |
368 | | /** Flush any unwritten bits to the output stream, padding with 0's to the |
369 | | * next byte boundary. |
370 | | */ |
371 | 31.7k | void Flush() { |
372 | 31.7k | if (m_offset == 0) { |
373 | 7.71k | return; |
374 | 7.71k | } |
375 | | |
376 | 24.0k | m_ostream << m_buffer; |
377 | 24.0k | m_buffer = 0; |
378 | 24.0k | m_offset = 0; |
379 | 24.0k | } BitStreamWriter<DataStream>::Flush() Line | Count | Source | 371 | 7 | void Flush() { | 372 | 7 | if (m_offset == 0) { | 373 | 1 | return; | 374 | 1 | } | 375 | | | 376 | 6 | m_ostream << m_buffer; | 377 | 6 | m_buffer = 0; | 378 | 6 | m_offset = 0; | 379 | 6 | } |
BitStreamWriter<VectorWriter>::Flush() Line | Count | Source | 371 | 31.7k | void Flush() { | 372 | 31.7k | if (m_offset == 0) { | 373 | 7.71k | return; | 374 | 7.71k | } | 375 | | | 376 | 24.0k | m_ostream << m_buffer; | 377 | 24.0k | m_buffer = 0; | 378 | 24.0k | m_offset = 0; | 379 | 24.0k | } |
|
380 | | }; |
381 | | |
382 | | /** Non-refcounted RAII wrapper for FILE* |
383 | | * |
384 | | * Will automatically close the file when it goes out of scope if not null. |
385 | | * If you're returning the file pointer, return file.release(). |
386 | | * If you need to close the file early, use autofile.fclose() instead of fclose(underlying_FILE). |
387 | | * |
388 | | * @note If the file has been written to, then the caller must close it |
389 | | * explicitly with the `fclose()` method, check if it returns an error and treat |
390 | | * such an error as if the `write()` method failed. The OS's `fclose(3)` may |
391 | | * fail to flush to disk data that has been previously written, rendering the |
392 | | * file corrupt. |
393 | | */ |
394 | | class AutoFile |
395 | | { |
396 | | protected: |
397 | | std::FILE* m_file; |
398 | | Obfuscation m_obfuscation; |
399 | | std::optional<int64_t> m_position; |
400 | | bool m_was_written{false}; |
401 | | |
402 | | public: |
403 | | explicit AutoFile(std::FILE* file, const Obfuscation& obfuscation = {}); |
404 | | |
405 | | ~AutoFile() |
406 | 418k | { |
407 | 418k | if (m_was_written) { |
408 | | // Callers that wrote to the file must have closed it explicitly |
409 | | // with the fclose() method and checked that the close succeeded. |
410 | | // This is because here in the destructor we have no way to signal |
411 | | // errors from fclose() which, after write, could mean the file is |
412 | | // corrupted and must be handled properly at the call site. |
413 | | // Destructors in C++ cannot signal an error to the callers because |
414 | | // they do not return a value and are not allowed to throw exceptions. |
415 | 217k | Assume(IsNull()); |
416 | 217k | } |
417 | | |
418 | 418k | if (fclose() != 0) { |
419 | 0 | LogError("Failed to close file: %s", SysErrorString(errno)); |
420 | 0 | } |
421 | 418k | } |
422 | | |
423 | | // Disallow copies |
424 | | AutoFile(const AutoFile&) = delete; |
425 | | AutoFile& operator=(const AutoFile&) = delete; |
426 | | |
427 | 240 | bool feof() const { return std::feof(m_file); } |
428 | | |
429 | | [[nodiscard]] int fclose() |
430 | 636k | { |
431 | 636k | if (auto rel{release()}) return std::fclose(rel); |
432 | 219k | return 0; |
433 | 636k | } |
434 | | |
435 | | /** Get wrapped FILE* with transfer of ownership. |
436 | | * @note This will invalidate the AutoFile object, and makes it the responsibility of the caller |
437 | | * of this function to clean up the returned FILE*. |
438 | | */ |
439 | | std::FILE* release() |
440 | 636k | { |
441 | 636k | std::FILE* ret{m_file}; |
442 | 636k | m_file = nullptr; |
443 | 636k | return ret; |
444 | 636k | } |
445 | | |
446 | | /** Return true if the wrapped FILE* is nullptr, false otherwise. |
447 | | */ |
448 | 1.05M | bool IsNull() const { return m_file == nullptr; } |
449 | | |
450 | | /** Continue with a different XOR key */ |
451 | 1.38k | void SetObfuscation(const Obfuscation& obfuscation) { m_obfuscation = obfuscation; } |
452 | | |
453 | | /** Implementation detail, only used internally. */ |
454 | | std::size_t detail_fread(std::span<std::byte> dst); |
455 | | |
456 | | /** Wrapper around fseek(). Will throw if seeking is not possible. */ |
457 | | void seek(int64_t offset, int origin); |
458 | | |
459 | | /** Find position within the file. Will throw if unknown. */ |
460 | | int64_t tell(); |
461 | | |
462 | | /** Return the size of the file. Will throw if unknown. */ |
463 | | int64_t size(); |
464 | | |
465 | | /** Wrapper around FileCommit(). */ |
466 | | bool Commit(); |
467 | | |
468 | | /** Wrapper around TruncateFile(). */ |
469 | | bool Truncate(unsigned size); |
470 | | |
471 | | //! Write a mutable buffer more efficiently than write(), obfuscating the buffer in-place. |
472 | | void write_buffer(std::span<std::byte> src); |
473 | | |
474 | | // |
475 | | // Stream subset |
476 | | // |
477 | | void read(std::span<std::byte> dst); |
478 | | void ignore(size_t nSize); |
479 | | void write(std::span<const std::byte> src); |
480 | | |
481 | | template <typename T> |
482 | | AutoFile& operator<<(const T& obj) |
483 | 41.0M | { |
484 | 41.0M | ::Serialize(*this, obj); |
485 | 41.0M | return *this; |
486 | 41.0M | } AutoFile& AutoFile::operator<<<Wrapper<LimitedStringFormatter<256ul>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>>(Wrapper<LimitedStringFormatter<256ul>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&> const&) Line | Count | Source | 483 | 3 | { | 484 | 3 | ::Serialize(*this, obj); | 485 | 3 | return *this; | 486 | 3 | } |
AutoFile& AutoFile::operator<<<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) Line | Count | Source | 483 | 3 | { | 484 | 3 | ::Serialize(*this, obj); | 485 | 3 | return *this; | 486 | 3 | } |
AutoFile& AutoFile::operator<<<std::byte>(std::byte const&) Line | Count | Source | 483 | 1 | { | 484 | 1 | ::Serialize(*this, obj); | 485 | 1 | return *this; | 486 | 1 | } |
AutoFile& AutoFile::operator<<<std::vector<unsigned char, std::allocator<unsigned char>>>(std::vector<unsigned char, std::allocator<unsigned char>> const&) Line | Count | Source | 483 | 7.54k | { | 484 | 7.54k | ::Serialize(*this, obj); | 485 | 7.54k | return *this; | 486 | 7.54k | } |
AutoFile& AutoFile::operator<<<unsigned char>(unsigned char const&) Line | Count | Source | 483 | 6.51k | { | 484 | 6.51k | ::Serialize(*this, obj); | 485 | 6.51k | return *this; | 486 | 6.51k | } |
AutoFile& AutoFile::operator<<<uint256>(uint256 const&) Line | Count | Source | 483 | 9.14k | { | 484 | 9.14k | ::Serialize(*this, obj); | 485 | 9.14k | return *this; | 486 | 9.14k | } |
AutoFile& AutoFile::operator<<<std::span<unsigned char const, 32ul>>(std::span<unsigned char const, 32ul> const&) Line | Count | Source | 483 | 16.4k | { | 484 | 16.4k | ::Serialize(*this, obj); | 485 | 16.4k | return *this; | 486 | 16.4k | } |
AutoFile& AutoFile::operator<<<std::span<char const, 18446744073709551615ul>>(std::span<char const, 18446744073709551615ul> const&) Line | Count | Source | 483 | 23 | { | 484 | 23 | ::Serialize(*this, obj); | 485 | 23 | return *this; | 486 | 23 | } |
AutoFile& AutoFile::operator<<<std::span<unsigned char const, 18446744073709551615ul>>(std::span<unsigned char const, 18446744073709551615ul> const&) Line | Count | Source | 483 | 495 | { | 484 | 495 | ::Serialize(*this, obj); | 485 | 495 | return *this; | 486 | 495 | } |
AutoFile& AutoFile::operator<<<std::array<std::byte, 8ul>>(std::array<std::byte, 8ul> const&) Line | Count | Source | 483 | 453 | { | 484 | 453 | ::Serialize(*this, obj); | 485 | 453 | return *this; | 486 | 453 | } |
AutoFile& AutoFile::operator<<<unsigned long>(unsigned long const&) Line | Count | Source | 483 | 40.9M | { | 484 | 40.9M | ::Serialize(*this, obj); | 485 | 40.9M | return *this; | 486 | 40.9M | } |
AutoFile& AutoFile::operator<<<Obfuscation>(Obfuscation const&) Line | Count | Source | 483 | 934 | { | 484 | 934 | ::Serialize(*this, obj); | 485 | 934 | return *this; | 486 | 934 | } |
AutoFile& AutoFile::operator<<<std::vector<std::byte, std::allocator<std::byte>>>(std::vector<std::byte, std::allocator<std::byte>> const&) Line | Count | Source | 483 | 934 | { | 484 | 934 | ::Serialize(*this, obj); | 485 | 934 | return *this; | 486 | 934 | } |
AutoFile& AutoFile::operator<<<ParamsWrapper<TransactionSerParams, CTransaction const>>(ParamsWrapper<TransactionSerParams, CTransaction const> const&) Line | Count | Source | 483 | 1.22k | { | 484 | 1.22k | ::Serialize(*this, obj); | 485 | 1.22k | return *this; | 486 | 1.22k | } |
AutoFile& AutoFile::operator<<<long>(long const&) Line | Count | Source | 483 | 2.44k | { | 484 | 2.44k | ::Serialize(*this, obj); | 485 | 2.44k | return *this; | 486 | 2.44k | } |
AutoFile& AutoFile::operator<<<std::map<transaction_identifier<false>, long, std::less<transaction_identifier<false>>, std::allocator<std::pair<transaction_identifier<false> const, long>>>>(std::map<transaction_identifier<false>, long, std::less<transaction_identifier<false>>, std::allocator<std::pair<transaction_identifier<false> const, long>>> const&) Line | Count | Source | 483 | 935 | { | 484 | 935 | ::Serialize(*this, obj); | 485 | 935 | return *this; | 486 | 935 | } |
AutoFile& AutoFile::operator<<<std::set<transaction_identifier<false>, std::less<transaction_identifier<false>>, std::allocator<transaction_identifier<false>>>>(std::set<transaction_identifier<false>, std::less<transaction_identifier<false>>, std::allocator<transaction_identifier<false>>> const&) Line | Count | Source | 483 | 935 | { | 484 | 935 | ::Serialize(*this, obj); | 485 | 935 | return *this; | 486 | 935 | } |
block_policy_estimator.cpp:AutoFile& AutoFile::operator<<<Wrapper<(anonymous namespace)::EncodedDoubleFormatter, double const&>>(Wrapper<(anonymous namespace)::EncodedDoubleFormatter, double const&> const&) Line | Count | Source | 483 | 3.18k | { | 484 | 3.18k | ::Serialize(*this, obj); | 485 | 3.18k | return *this; | 486 | 3.18k | } |
AutoFile& AutoFile::operator<<<unsigned int>(unsigned int const&) Line | Count | Source | 483 | 6.36k | { | 484 | 6.36k | ::Serialize(*this, obj); | 485 | 6.36k | return *this; | 486 | 6.36k | } |
block_policy_estimator.cpp:AutoFile& AutoFile::operator<<<Wrapper<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>, std::vector<double, std::allocator<double>> const&>>(Wrapper<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>, std::vector<double, std::allocator<double>> const&> const&) Line | Count | Source | 483 | 7.42k | { | 484 | 7.42k | ::Serialize(*this, obj); | 485 | 7.42k | return *this; | 486 | 7.42k | } |
block_policy_estimator.cpp:AutoFile& AutoFile::operator<<<Wrapper<VectorFormatter<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>>, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>> const&>>(Wrapper<VectorFormatter<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>>, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>> const&> const&) Line | Count | Source | 483 | 6.36k | { | 484 | 6.36k | ::Serialize(*this, obj); | 485 | 6.36k | return *this; | 486 | 6.36k | } |
AutoFile& AutoFile::operator<<<int>(int const&) Line | Count | Source | 483 | 1.06k | { | 484 | 1.06k | ::Serialize(*this, obj); | 485 | 1.06k | return *this; | 486 | 1.06k | } |
AutoFile& AutoFile::operator<<<transaction_identifier<false>>(transaction_identifier<false> const&) Line | Count | Source | 483 | 6.55k | { | 484 | 6.55k | ::Serialize(*this, obj); | 485 | 6.55k | return *this; | 486 | 6.55k | } |
AutoFile& AutoFile::operator<<<Coin>(Coin const&) Line | Count | Source | 483 | 6.58k | { | 484 | 6.58k | ::Serialize(*this, obj); | 485 | 6.58k | return *this; | 486 | 6.58k | } |
AutoFile& AutoFile::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&> const&) Line | Count | Source | 483 | 6.58k | { | 484 | 6.58k | ::Serialize(*this, obj); | 485 | 6.58k | return *this; | 486 | 6.58k | } |
AutoFile& AutoFile::operator<<<std::span<unsigned char, 18446744073709551615ul>>(std::span<unsigned char, 18446744073709551615ul> const&) Line | Count | Source | 483 | 6.11k | { | 484 | 6.11k | ::Serialize(*this, obj); | 485 | 6.11k | return *this; | 486 | 6.11k | } |
AutoFile& AutoFile::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&> const&) Line | Count | Source | 483 | 472 | { | 484 | 472 | ::Serialize(*this, obj); | 485 | 472 | return *this; | 486 | 472 | } |
AutoFile& AutoFile::operator<<<node::SnapshotMetadata>(node::SnapshotMetadata const&) Line | Count | Source | 483 | 44 | { | 484 | 44 | ::Serialize(*this, obj); | 485 | 44 | return *this; | 486 | 44 | } |
AutoFile& AutoFile::operator<<<std::array<unsigned char, 5ul>>(std::array<unsigned char, 5ul> const&) Line | Count | Source | 483 | 44 | { | 484 | 44 | ::Serialize(*this, obj); | 485 | 44 | return *this; | 486 | 44 | } |
AutoFile& AutoFile::operator<<<unsigned short>(unsigned short const&) Line | Count | Source | 483 | 44 | { | 484 | 44 | ::Serialize(*this, obj); | 485 | 44 | return *this; | 486 | 44 | } |
AutoFile& AutoFile::operator<<<std::array<unsigned char, 4ul>>(std::array<unsigned char, 4ul> const&) Line | Count | Source | 483 | 44 | { | 484 | 44 | ::Serialize(*this, obj); | 485 | 44 | return *this; | 486 | 44 | } |
AutoFile& AutoFile::operator<<<std::span<std::byte const, 1519688ul>>(std::span<std::byte const, 1519688ul> const&) Line | Count | Source | 483 | 1 | { | 484 | 1 | ::Serialize(*this, obj); | 485 | 1 | return *this; | 486 | 1 | } |
|
487 | | |
488 | | template <typename T> |
489 | | AutoFile& operator>>(T&& obj) |
490 | 21.9M | { |
491 | 21.9M | ::Unserialize(*this, obj); |
492 | 21.9M | return *this; |
493 | 21.9M | } AutoFile& AutoFile::operator>><Wrapper<LimitedStringFormatter<256ul>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>>(Wrapper<LimitedStringFormatter<256ul>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>&&) Line | Count | Source | 490 | 4 | { | 491 | 4 | ::Unserialize(*this, obj); | 492 | 4 | return *this; | 493 | 4 | } |
AutoFile& AutoFile::operator>><std::byte>(std::byte&&) Line | Count | Source | 490 | 3 | { | 491 | 3 | ::Unserialize(*this, obj); | 492 | 3 | return *this; | 493 | 3 | } |
AutoFile& AutoFile::operator>><std::span<std::byte, 18446744073709551615ul>>(std::span<std::byte, 18446744073709551615ul>&&) Line | Count | Source | 490 | 1 | { | 491 | 1 | ::Unserialize(*this, obj); | 492 | 1 | return *this; | 493 | 1 | } |
AutoFile& AutoFile::operator>><std::vector<std::byte, std::allocator<std::byte>>&>(std::vector<std::byte, std::allocator<std::byte>>&) Line | Count | Source | 490 | 451 | { | 491 | 451 | ::Unserialize(*this, obj); | 492 | 451 | return *this; | 493 | 451 | } |
AutoFile& AutoFile::operator>><unsigned char&>(unsigned char&) Line | Count | Source | 490 | 3.23k | { | 491 | 3.23k | ::Unserialize(*this, obj); | 492 | 3.23k | return *this; | 493 | 3.23k | } |
AutoFile& AutoFile::operator>><node::SnapshotMetadata&>(node::SnapshotMetadata&) Line | Count | Source | 490 | 73 | { | 491 | 73 | ::Unserialize(*this, obj); | 492 | 73 | return *this; | 493 | 73 | } |
AutoFile& AutoFile::operator>><std::array<unsigned char, 5ul>&>(std::array<unsigned char, 5ul>&) Line | Count | Source | 490 | 73 | { | 491 | 73 | ::Unserialize(*this, obj); | 492 | 73 | return *this; | 493 | 73 | } |
AutoFile& AutoFile::operator>><unsigned short&>(unsigned short&) Line | Count | Source | 490 | 5.48k | { | 491 | 5.48k | ::Unserialize(*this, obj); | 492 | 5.48k | return *this; | 493 | 5.48k | } |
AutoFile& AutoFile::operator>><std::array<unsigned char, 4ul>&>(std::array<unsigned char, 4ul>&) Line | Count | Source | 490 | 158k | { | 491 | 158k | ::Unserialize(*this, obj); | 492 | 158k | return *this; | 493 | 158k | } |
AutoFile& AutoFile::operator>><uint256&>(uint256&) Line | Count | Source | 490 | 2.05k | { | 491 | 2.05k | ::Unserialize(*this, obj); | 492 | 2.05k | return *this; | 493 | 2.05k | } |
AutoFile& AutoFile::operator>><unsigned long&>(unsigned long&) Line | Count | Source | 490 | 21.5M | { | 491 | 21.5M | ::Unserialize(*this, obj); | 492 | 21.5M | return *this; | 493 | 21.5M | } |
AutoFile& AutoFile::operator>><transaction_identifier<false>&>(transaction_identifier<false>&) Line | Count | Source | 490 | 6.36k | { | 491 | 6.36k | ::Unserialize(*this, obj); | 492 | 6.36k | return *this; | 493 | 6.36k | } |
AutoFile& AutoFile::operator>><Coin&>(Coin&) Line | Count | Source | 490 | 6.35k | { | 491 | 6.35k | ::Unserialize(*this, obj); | 492 | 6.35k | return *this; | 493 | 6.35k | } |
AutoFile& AutoFile::operator>><Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>&&) Line | Count | Source | 490 | 6.35k | { | 491 | 6.35k | ::Unserialize(*this, obj); | 492 | 6.35k | return *this; | 493 | 6.35k | } |
AutoFile& AutoFile::operator>><Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>&&) Line | Count | Source | 490 | 6.35k | { | 491 | 6.35k | ::Unserialize(*this, obj); | 492 | 6.35k | return *this; | 493 | 6.35k | } |
AutoFile& AutoFile::operator>><std::span<unsigned char, 18446744073709551615ul>>(std::span<unsigned char, 18446744073709551615ul>&&) Line | Count | Source | 490 | 6.35k | { | 491 | 6.35k | ::Unserialize(*this, obj); | 492 | 6.35k | return *this; | 493 | 6.35k | } |
Unexecuted instantiation: AutoFile& AutoFile::operator>><Wrapper<CustomUintFormatter<1, false>, AddrManImpl::Format&>>(Wrapper<CustomUintFormatter<1, false>, AddrManImpl::Format&>&&) AutoFile& AutoFile::operator>><std::vector<unsigned char, std::allocator<unsigned char>>&>(std::vector<unsigned char, std::allocator<unsigned char>>&) Line | Count | Source | 490 | 1.38k | { | 491 | 1.38k | ::Unserialize(*this, obj); | 492 | 1.38k | return *this; | 493 | 1.38k | } |
AutoFile& AutoFile::operator>><CBlockHeader&>(CBlockHeader&) Line | Count | Source | 490 | 162 | { | 491 | 162 | ::Unserialize(*this, obj); | 492 | 162 | return *this; | 493 | 162 | } |
AutoFile& AutoFile::operator>><ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const>>>(ParamsWrapper<TransactionSerParams, std::shared_ptr<CTransaction const>>&&) Line | Count | Source | 490 | 462 | { | 491 | 462 | ::Unserialize(*this, obj); | 492 | 462 | return *this; | 493 | 462 | } |
AutoFile& AutoFile::operator>><std::array<std::byte, 8ul>&>(std::array<std::byte, 8ul>&) Line | Count | Source | 490 | 757 | { | 491 | 757 | ::Unserialize(*this, obj); | 492 | 757 | return *this; | 493 | 757 | } |
AutoFile& AutoFile::operator>><unsigned int&>(unsigned int&) Line | Count | Source | 490 | 164k | { | 491 | 164k | ::Unserialize(*this, obj); | 492 | 164k | return *this; | 493 | 164k | } |
AutoFile& AutoFile::operator>><Obfuscation&>(Obfuscation&) Line | Count | Source | 490 | 448 | { | 491 | 448 | ::Unserialize(*this, obj); | 492 | 448 | return *this; | 493 | 448 | } |
AutoFile& AutoFile::operator>><long&>(long&) Line | Count | Source | 490 | 600 | { | 491 | 600 | ::Unserialize(*this, obj); | 492 | 600 | return *this; | 493 | 600 | } |
AutoFile& AutoFile::operator>><std::map<transaction_identifier<false>, long, std::less<transaction_identifier<false>>, std::allocator<std::pair<transaction_identifier<false> const, long>>>&>(std::map<transaction_identifier<false>, long, std::less<transaction_identifier<false>>, std::allocator<std::pair<transaction_identifier<false> const, long>>>&) Line | Count | Source | 490 | 449 | { | 491 | 449 | ::Unserialize(*this, obj); | 492 | 449 | return *this; | 493 | 449 | } |
AutoFile& AutoFile::operator>><std::set<transaction_identifier<false>, std::less<transaction_identifier<false>>, std::allocator<transaction_identifier<false>>>&>(std::set<transaction_identifier<false>, std::less<transaction_identifier<false>>, std::allocator<transaction_identifier<false>>>&) Line | Count | Source | 490 | 449 | { | 491 | 449 | ::Unserialize(*this, obj); | 492 | 449 | return *this; | 493 | 449 | } |
block_policy_estimator.cpp:AutoFile& AutoFile::operator>><Wrapper<(anonymous namespace)::EncodedDoubleFormatter, double&>>(Wrapper<(anonymous namespace)::EncodedDoubleFormatter, double&>&&) Line | Count | Source | 490 | 1.67k | { | 491 | 1.67k | ::Unserialize(*this, obj); | 492 | 1.67k | return *this; | 493 | 1.67k | } |
block_policy_estimator.cpp:AutoFile& AutoFile::operator>><Wrapper<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>, std::vector<double, std::allocator<double>>&>>(Wrapper<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>, std::vector<double, std::allocator<double>>&>&&) Line | Count | Source | 490 | 3.90k | { | 491 | 3.90k | ::Unserialize(*this, obj); | 492 | 3.90k | return *this; | 493 | 3.90k | } |
block_policy_estimator.cpp:AutoFile& AutoFile::operator>><Wrapper<VectorFormatter<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>>, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&>>(Wrapper<VectorFormatter<VectorFormatter<(anonymous namespace)::EncodedDoubleFormatter>>, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&>&&) Line | Count | Source | 490 | 3.34k | { | 491 | 3.34k | ::Unserialize(*this, obj); | 492 | 3.34k | return *this; | 493 | 3.34k | } |
AutoFile& AutoFile::operator>><int&>(int&) Line | Count | Source | 490 | 558 | { | 491 | 558 | ::Unserialize(*this, obj); | 492 | 558 | return *this; | 493 | 558 | } |
AutoFile& AutoFile::operator>><std::byte&>(std::byte&) Line | Count | Source | 490 | 27 | { | 491 | 27 | ::Unserialize(*this, obj); | 492 | 27 | return *this; | 493 | 27 | } |
AutoFile& AutoFile::operator>><wallet::MetaPage&>(wallet::MetaPage&) Line | Count | Source | 490 | 88 | { | 491 | 88 | ::Unserialize(*this, obj); | 492 | 88 | return *this; | 493 | 88 | } |
AutoFile& AutoFile::operator>><std::array<std::byte, 20ul>&>(std::array<std::byte, 20ul>&) Line | Count | Source | 490 | 88 | { | 491 | 88 | ::Unserialize(*this, obj); | 492 | 88 | return *this; | 493 | 88 | } |
AutoFile& AutoFile::operator>><char (&) [368]>(char (&) [368]) Line | Count | Source | 490 | 88 | { | 491 | 88 | ::Unserialize(*this, obj); | 492 | 88 | return *this; | 493 | 88 | } |
AutoFile& AutoFile::operator>><char (&) [12]>(char (&) [12]) Line | Count | Source | 490 | 88 | { | 491 | 88 | ::Unserialize(*this, obj); | 492 | 88 | return *this; | 493 | 88 | } |
AutoFile& AutoFile::operator>><unsigned char (&) [20]>(unsigned char (&) [20]) Line | Count | Source | 490 | 88 | { | 491 | 88 | ::Unserialize(*this, obj); | 492 | 88 | return *this; | 493 | 88 | } |
AutoFile& AutoFile::operator>><unsigned char (&) [16]>(unsigned char (&) [16]) Line | Count | Source | 490 | 88 | { | 491 | 88 | ::Unserialize(*this, obj); | 492 | 88 | return *this; | 493 | 88 | } |
AutoFile& AutoFile::operator>><wallet::PageHeader&>(wallet::PageHeader&) Line | Count | Source | 490 | 130 | { | 491 | 130 | ::Unserialize(*this, obj); | 492 | 130 | return *this; | 493 | 130 | } |
AutoFile& AutoFile::operator>><wallet::RecordsPage&>(wallet::RecordsPage&) Line | Count | Source | 490 | 116 | { | 491 | 116 | ::Unserialize(*this, obj); | 492 | 116 | return *this; | 493 | 116 | } |
AutoFile& AutoFile::operator>><wallet::RecordHeader&>(wallet::RecordHeader&) Line | Count | Source | 490 | 2.57k | { | 491 | 2.57k | ::Unserialize(*this, obj); | 492 | 2.57k | return *this; | 493 | 2.57k | } |
AutoFile& AutoFile::operator>><wallet::DataRecord&>(wallet::DataRecord&) Line | Count | Source | 490 | 2.53k | { | 491 | 2.53k | ::Unserialize(*this, obj); | 492 | 2.53k | return *this; | 493 | 2.53k | } |
Unexecuted instantiation: AutoFile& AutoFile::operator>><wallet::OverflowRecord&>(wallet::OverflowRecord&) AutoFile& AutoFile::operator>><wallet::InternalPage&>(wallet::InternalPage&) Line | Count | Source | 490 | 14 | { | 491 | 14 | ::Unserialize(*this, obj); | 492 | 14 | return *this; | 493 | 14 | } |
AutoFile& AutoFile::operator>><wallet::InternalRecord&>(wallet::InternalRecord&) Line | Count | Source | 490 | 42 | { | 491 | 42 | ::Unserialize(*this, obj); | 492 | 42 | return *this; | 493 | 42 | } |
Unexecuted instantiation: AutoFile& AutoFile::operator>><wallet::OverflowPage&>(wallet::OverflowPage&) |
494 | | }; |
495 | | |
496 | | using DataBuffer = std::vector<std::byte>; |
497 | | |
498 | | /** Wrapper around an AutoFile& that implements a ring buffer to |
499 | | * deserialize from. It guarantees the ability to rewind a given number of bytes. |
500 | | * |
501 | | * Will automatically close the file when it goes out of scope if not null. |
502 | | * If you need to close the file early, use file.fclose() instead of fclose(file). |
503 | | */ |
504 | | class BufferedFile |
505 | | { |
506 | | private: |
507 | | AutoFile& m_src; |
508 | | uint64_t nSrcPos{0}; //!< how many bytes have been read from source |
509 | | uint64_t m_read_pos{0}; //!< how many bytes have been read from this |
510 | | uint64_t nReadLimit; //!< up to which position we're allowed to read |
511 | | uint64_t nRewind; //!< how many bytes we guarantee to rewind |
512 | | DataBuffer vchBuf; |
513 | | |
514 | | //! read data from the source to fill the buffer |
515 | 390 | bool Fill() { |
516 | 390 | unsigned int pos = nSrcPos % vchBuf.size(); |
517 | 390 | unsigned int readNow = vchBuf.size() - pos; |
518 | 390 | unsigned int nAvail = vchBuf.size() - (nSrcPos - m_read_pos) - nRewind; |
519 | 390 | if (nAvail < readNow) |
520 | 327 | readNow = nAvail; |
521 | 390 | if (readNow == 0) |
522 | 0 | return false; |
523 | 390 | size_t nBytes{m_src.detail_fread(std::span{vchBuf}.subspan(pos, readNow))}; |
524 | 390 | if (nBytes == 0) { |
525 | 14 | throw std::ios_base::failure{m_src.feof() ? "BufferedFile::Fill: end of file" : "BufferedFile::Fill: fread failed"}; |
526 | 14 | } |
527 | 376 | nSrcPos += nBytes; |
528 | 376 | return true; |
529 | 390 | } |
530 | | |
531 | | //! Advance the stream's read pointer (m_read_pos) by up to 'length' bytes, |
532 | | //! filling the buffer from the file so that at least one byte is available. |
533 | | //! Return a pointer to the available buffer data and the number of bytes |
534 | | //! (which may be less than the requested length) that may be accessed |
535 | | //! beginning at that pointer. |
536 | | std::pair<std::byte*, size_t> AdvanceStream(size_t length) |
537 | 73.1k | { |
538 | 73.1k | assert(m_read_pos <= nSrcPos); |
539 | 73.1k | if (m_read_pos + length > nReadLimit) { |
540 | 2 | throw std::ios_base::failure("Attempt to position past buffer limit"); |
541 | 2 | } |
542 | | // If there are no bytes available, read from the file. |
543 | 73.1k | if (m_read_pos == nSrcPos && length > 0) Fill(); |
544 | | |
545 | 73.1k | size_t buffer_offset{static_cast<size_t>(m_read_pos % vchBuf.size())}; |
546 | 73.1k | size_t buffer_available{static_cast<size_t>(vchBuf.size() - buffer_offset)}; |
547 | 73.1k | size_t bytes_until_source_pos{static_cast<size_t>(nSrcPos - m_read_pos)}; |
548 | 73.1k | size_t advance{std::min({length, buffer_available, bytes_until_source_pos})}; |
549 | 73.1k | m_read_pos += advance; |
550 | 73.1k | return std::make_pair(&vchBuf[buffer_offset], advance); |
551 | 73.1k | } |
552 | | |
553 | | public: |
554 | | BufferedFile(AutoFile& file LIFETIMEBOUND, uint64_t nBufSize, uint64_t nRewindIn) |
555 | 69 | : m_src{file}, nReadLimit{std::numeric_limits<uint64_t>::max()}, nRewind{nRewindIn}, vchBuf(nBufSize, std::byte{0}) |
556 | 69 | { |
557 | 69 | if (nRewindIn >= nBufSize) |
558 | 1 | throw std::ios_base::failure("Rewind limit must be less than buffer size"); |
559 | 69 | } |
560 | | |
561 | | //! check whether we're at the end of the source file |
562 | 5.87k | bool eof() const { |
563 | 5.87k | return m_read_pos == nSrcPos && m_src.feof(); |
564 | 5.87k | } |
565 | | |
566 | | //! read a number of bytes |
567 | | void read(std::span<std::byte> dst) |
568 | 70.5k | { |
569 | 141k | while (dst.size() > 0) { |
570 | 70.6k | auto [buffer_pointer, length]{AdvanceStream(dst.size())}; |
571 | 70.6k | memcpy(dst.data(), buffer_pointer, length); |
572 | 70.6k | dst = dst.subspan(length); |
573 | 70.6k | } |
574 | 70.5k | } |
575 | | |
576 | | //! Move the read position ahead in the stream to the given position. |
577 | | //! Use SetPos() to back up in the stream, not SkipTo(). |
578 | | void SkipTo(const uint64_t file_pos) |
579 | 2.59k | { |
580 | 2.59k | assert(file_pos >= m_read_pos); |
581 | 5.08k | while (m_read_pos < file_pos) AdvanceStream(file_pos - m_read_pos); |
582 | 2.59k | } |
583 | | |
584 | | //! return the current reading position |
585 | 11.0k | uint64_t GetPos() const { |
586 | 11.0k | return m_read_pos; |
587 | 11.0k | } |
588 | | |
589 | | //! rewind to a given reading position |
590 | 4.53k | bool SetPos(uint64_t nPos) { |
591 | 4.53k | size_t bufsize = vchBuf.size(); |
592 | 4.53k | if (nPos + bufsize < nSrcPos) { |
593 | | // rewinding too far, rewind as far as possible |
594 | 67 | m_read_pos = nSrcPos - bufsize; |
595 | 67 | return false; |
596 | 67 | } |
597 | 4.46k | if (nPos > nSrcPos) { |
598 | | // can't go this far forward, go as far as possible |
599 | 17 | m_read_pos = nSrcPos; |
600 | 17 | return false; |
601 | 17 | } |
602 | 4.44k | m_read_pos = nPos; |
603 | 4.44k | return true; |
604 | 4.46k | } |
605 | | |
606 | | //! prevent reading beyond a certain position |
607 | | //! no argument removes the limit |
608 | 7.16k | bool SetLimit(uint64_t nPos = std::numeric_limits<uint64_t>::max()) { |
609 | 7.16k | if (nPos < m_read_pos) |
610 | 0 | return false; |
611 | 7.16k | nReadLimit = nPos; |
612 | 7.16k | return true; |
613 | 7.16k | } |
614 | | |
615 | | template<typename T> |
616 | 10.4k | BufferedFile& operator>>(T&& obj) { |
617 | 10.4k | ::Unserialize(*this, obj); |
618 | 10.4k | return (*this); |
619 | 10.4k | } BufferedFile& BufferedFile::operator>><unsigned char&>(unsigned char&) Line | Count | Source | 616 | 671 | BufferedFile& operator>>(T&& obj) { | 617 | 671 | ::Unserialize(*this, obj); | 618 | 671 | return (*this); | 619 | 671 | } |
BufferedFile& BufferedFile::operator>><unsigned char (&) [29]>(unsigned char (&) [29]) Line | Count | Source | 616 | 1 | BufferedFile& operator>>(T&& obj) { | 617 | 1 | ::Unserialize(*this, obj); | 618 | 1 | return (*this); | 619 | 1 | } |
BufferedFile& BufferedFile::operator>><unsigned char (&) [1]>(unsigned char (&) [1]) Line | Count | Source | 616 | 644 | BufferedFile& operator>>(T&& obj) { | 617 | 644 | ::Unserialize(*this, obj); | 618 | 644 | return (*this); | 619 | 644 | } |
BufferedFile& BufferedFile::operator>><unsigned char (&) [2]>(unsigned char (&) [2]) Line | Count | Source | 616 | 635 | BufferedFile& operator>>(T&& obj) { | 617 | 635 | ::Unserialize(*this, obj); | 618 | 635 | return (*this); | 619 | 635 | } |
BufferedFile& BufferedFile::operator>><unsigned char (&) [5]>(unsigned char (&) [5]) Line | Count | Source | 616 | 647 | BufferedFile& operator>>(T&& obj) { | 617 | 647 | ::Unserialize(*this, obj); | 618 | 647 | return (*this); | 619 | 647 | } |
BufferedFile& BufferedFile::operator>><std::array<unsigned char, 4ul>&>(std::array<unsigned char, 4ul>&) Line | Count | Source | 616 | 1.97k | BufferedFile& operator>>(T&& obj) { | 617 | 1.97k | ::Unserialize(*this, obj); | 618 | 1.97k | return (*this); | 619 | 1.97k | } |
BufferedFile& BufferedFile::operator>><unsigned int&>(unsigned int&) Line | Count | Source | 616 | 1.97k | BufferedFile& operator>>(T&& obj) { | 617 | 1.97k | ::Unserialize(*this, obj); | 618 | 1.97k | return (*this); | 619 | 1.97k | } |
BufferedFile& BufferedFile::operator>><CBlockHeader&>(CBlockHeader&) Line | Count | Source | 616 | 1.97k | BufferedFile& operator>>(T&& obj) { | 617 | 1.97k | ::Unserialize(*this, obj); | 618 | 1.97k | return (*this); | 619 | 1.97k | } |
BufferedFile& BufferedFile::operator>><ParamsWrapper<TransactionSerParams, CBlock>>(ParamsWrapper<TransactionSerParams, CBlock>&&) Line | Count | Source | 616 | 1.87k | BufferedFile& operator>>(T&& obj) { | 617 | 1.87k | ::Unserialize(*this, obj); | 618 | 1.87k | return (*this); | 619 | 1.87k | } |
|
620 | | |
621 | | //! search for a given byte in the stream, and remain positioned on it |
622 | | void FindByte(std::byte byte) |
623 | 2.64k | { |
624 | | // For best performance, avoid mod operation within the loop. |
625 | 2.64k | size_t buf_offset{size_t(m_read_pos % uint64_t(vchBuf.size()))}; |
626 | 2.81k | while (true) { |
627 | 2.80k | if (m_read_pos == nSrcPos) { |
628 | | // No more bytes available; read from the file into the buffer, |
629 | | // setting nSrcPos to one beyond the end of the new data. |
630 | | // Throws exception if end-of-file reached. |
631 | 187 | Fill(); |
632 | 187 | } |
633 | 2.80k | const size_t len{std::min<size_t>(vchBuf.size() - buf_offset, nSrcPos - m_read_pos)}; |
634 | 2.80k | const auto it_start{vchBuf.begin() + buf_offset}; |
635 | 2.80k | const auto it_find{std::find(it_start, it_start + len, byte)}; |
636 | 2.80k | const size_t inc{size_t(std::distance(it_start, it_find))}; |
637 | 2.80k | m_read_pos += inc; |
638 | 2.80k | if (inc < len) break; |
639 | 172 | buf_offset += inc; |
640 | 172 | if (buf_offset >= vchBuf.size()) buf_offset = 0; |
641 | 172 | } |
642 | 2.64k | } |
643 | | }; |
644 | | |
645 | | /** |
646 | | * Wrapper that buffers reads from an underlying stream. |
647 | | * Requires underlying stream to support read() and detail_fread() calls |
648 | | * to support fixed-size and variable-sized reads, respectively. |
649 | | */ |
650 | | template <typename S> |
651 | | class BufferedReader |
652 | | { |
653 | | S& m_src; |
654 | | DataBuffer m_buf; |
655 | | size_t m_buf_pos; |
656 | | |
657 | | public: |
658 | | //! Requires stream ownership to prevent leaving the stream at an unexpected position after buffered reads. |
659 | | explicit BufferedReader(S&& stream LIFETIMEBOUND, size_t size = 1 << 16) |
660 | | requires std::is_rvalue_reference_v<S&&> |
661 | 36.4k | : m_src{stream}, m_buf(size), m_buf_pos{size} {} |
662 | | |
663 | | void read(std::span<std::byte> dst) |
664 | 297k | { |
665 | 297k | if (const auto available{std::min(dst.size(), m_buf.size() - m_buf_pos)}) { |
666 | 260k | std::copy_n(m_buf.begin() + m_buf_pos, available, dst.begin()); |
667 | 260k | m_buf_pos += available; |
668 | 260k | dst = dst.subspan(available); |
669 | 260k | } |
670 | 297k | if (dst.size()) { |
671 | 36.4k | assert(m_buf_pos == m_buf.size()); |
672 | 36.4k | m_src.read(dst); |
673 | | |
674 | 36.4k | m_buf_pos = 0; |
675 | 36.4k | m_buf.resize(m_src.detail_fread(m_buf)); |
676 | 36.4k | } |
677 | 297k | } |
678 | | |
679 | | template <typename T> |
680 | | BufferedReader& operator>>(T&& obj) |
681 | 36.4k | { |
682 | 36.4k | Unserialize(*this, obj); |
683 | 36.4k | return *this; |
684 | 36.4k | } BufferedReader<AutoFile>& BufferedReader<AutoFile>::operator>><unsigned int&>(unsigned int&) Line | Count | Source | 681 | 2 | { | 682 | 2 | Unserialize(*this, obj); | 683 | 2 | return *this; | 684 | 2 | } |
BufferedReader<AutoFile>& BufferedReader<AutoFile>::operator>><uint256&>(uint256&) Line | Count | Source | 681 | 36.4k | { | 682 | 36.4k | Unserialize(*this, obj); | 683 | 36.4k | return *this; | 684 | 36.4k | } |
|
685 | | }; |
686 | | |
687 | | /** |
688 | | * Wrapper that buffers writes to an underlying stream. |
689 | | * Requires underlying stream to support write_buffer() method |
690 | | * for efficient buffer flushing and obfuscation. |
691 | | */ |
692 | | template <typename S> |
693 | | class BufferedWriter |
694 | | { |
695 | | S& m_dst; |
696 | | DataBuffer m_buf; |
697 | | size_t m_buf_pos{0}; |
698 | | |
699 | | public: |
700 | 205k | explicit BufferedWriter(S& stream LIFETIMEBOUND, size_t size = 1 << 16) : m_dst{stream}, m_buf(size) {} |
701 | | |
702 | 205k | ~BufferedWriter() { flush(); } |
703 | | |
704 | | void flush() |
705 | 223k | { |
706 | 223k | if (m_buf_pos) m_dst.write_buffer(std::span{m_buf}.first(m_buf_pos)); |
707 | 223k | m_buf_pos = 0; |
708 | 223k | } |
709 | | |
710 | | void write(std::span<const std::byte> src) |
711 | 6.08M | { |
712 | 12.1M | while (const auto available{std::min(src.size(), m_buf.size() - m_buf_pos)}) { |
713 | 6.10M | std::copy_n(src.begin(), available, m_buf.begin() + m_buf_pos); |
714 | 6.10M | m_buf_pos += available; |
715 | 6.10M | if (m_buf_pos == m_buf.size()) flush(); |
716 | 6.10M | src = src.subspan(available); |
717 | 6.10M | } |
718 | 6.08M | } |
719 | | |
720 | | template <typename T> |
721 | | BufferedWriter& operator<<(const T& obj) |
722 | 1.01M | { |
723 | 1.01M | Serialize(*this, obj); |
724 | 1.01M | return *this; |
725 | 1.01M | } BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<unsigned int>(unsigned int const&) Line | Count | Source | 722 | 205k | { | 723 | 205k | Serialize(*this, obj); | 724 | 205k | return *this; | 725 | 205k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<std::array<unsigned char, 4ul>>(std::array<unsigned char, 4ul> const&) Line | Count | Source | 722 | 205k | { | 723 | 205k | Serialize(*this, obj); | 724 | 205k | return *this; | 725 | 205k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<CBlockUndo>(CBlockUndo const&) Line | Count | Source | 722 | 101k | { | 723 | 101k | Serialize(*this, obj); | 724 | 101k | return *this; | 725 | 101k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned long&> const&) Line | Count | Source | 722 | 67.2k | { | 723 | 67.2k | Serialize(*this, obj); | 724 | 67.2k | return *this; | 725 | 67.2k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<std::span<unsigned char, 18446744073709551615ul>>(std::span<unsigned char, 18446744073709551615ul> const&) Line | Count | Source | 722 | 8.93k | { | 723 | 8.93k | Serialize(*this, obj); | 724 | 8.93k | return *this; | 725 | 8.93k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&>>(Wrapper<VarIntFormatter<(VarIntMode)0>, unsigned int&> const&) Line | Count | Source | 722 | 58.2k | { | 723 | 58.2k | Serialize(*this, obj); | 724 | 58.2k | return *this; | 725 | 58.2k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<std::span<unsigned char const, 18446744073709551615ul>>(std::span<unsigned char const, 18446744073709551615ul> const&) Line | Count | Source | 722 | 58.2k | { | 723 | 58.2k | Serialize(*this, obj); | 724 | 58.2k | return *this; | 725 | 58.2k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<uint256>(uint256 const&) Line | Count | Source | 722 | 101k | { | 723 | 101k | Serialize(*this, obj); | 724 | 101k | return *this; | 725 | 101k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<std::span<unsigned char const, 32ul>>(std::span<unsigned char const, 32ul> const&) Line | Count | Source | 722 | 101k | { | 723 | 101k | Serialize(*this, obj); | 724 | 101k | return *this; | 725 | 101k | } |
BufferedWriter<AutoFile>& BufferedWriter<AutoFile>::operator<<<ParamsWrapper<TransactionSerParams, CBlock const>>(ParamsWrapper<TransactionSerParams, CBlock const> const&) Line | Count | Source | 722 | 104k | { | 723 | 104k | Serialize(*this, obj); | 724 | 104k | return *this; | 725 | 104k | } |
|
726 | | }; |
727 | | |
728 | | #endif // BITCOIN_STREAMS_H |