MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / OverrideStream

Class OverrideStream

src/streams.h:26–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25template<typename Stream>
26class OverrideStream
27{
28 Stream* stream;
29
30 const int nType;
31 const int nVersion;
32
33public:
34 OverrideStream(Stream* stream_, int nType_, int nVersion_) : stream(stream_), nType(nType_), nVersion(nVersion_) {}
35
36 template<typename T>
37 OverrideStream<Stream>& operator<<(const T& obj)
38 {
39 // Serialize to this stream
40 ::Serialize(*this, obj);
41 return (*this);
42 }
43
44 template<typename T>
45 OverrideStream<Stream>& operator>>(T&& obj)
46 {
47 // Unserialize from this stream
48 ::Unserialize(*this, obj);
49 return (*this);
50 }
51
52 void write(const char* pch, size_t nSize)
53 {
54 stream->write(pch, nSize);
55 }
56
57 void read(char* pch, size_t nSize)
58 {
59 stream->read(pch, nSize);
60 }
61
62 int GetVersion() const { return nVersion; }
63 int GetType() const { return nType; }
64 size_t size() const { return stream->size(); }
65};
66
67template<typename S>
68OverrideStream<S> WithOrVersion(S* s, int nVersionFlag)

Callers

nothing calls this directly

Calls 2

UnserializeFunction · 0.85
SerializeFunction · 0.70

Tested by

no test coverage detected