MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / WriterStream

Class WriterStream

src/kernel/bitcoinkernel.cpp:78–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78class WriterStream
79{
80private:
81 btck_WriteBytes m_writer;
82 void* m_user_data;
83
84public:
85 WriterStream(btck_WriteBytes writer, void* user_data)
86 : m_writer{writer}, m_user_data{user_data} {}
87
88 //
89 // Stream subset
90 //
91 void write(std::span<const std::byte> src)
92 {
93 if (m_writer(src.data(), src.size(), m_user_data) != 0) {
94 throw std::runtime_error("Failed to write serialization data");
95 }
96 }
97
98 template <typename T>
99 WriterStream& operator<<(const T& obj)
100 {
101 ::Serialize(*this, obj);
102 return *this;
103 }
104};
105
106template <typename C, typename CPP>
107struct Handle {

Callers

nothing calls this directly

Calls 1

SerializeFunction · 0.50

Tested by

no test coverage detected