Page MenuHomePhabricator

Add a generic approach for (de)serialization of objects using code in other classes
ClosedPublic

Authored by PiRK on Dec 8 2020, 13:50.

Details

Summary

PR description:

This introduces a const-correct generic approach for serializing objects using custom
serializers (defined separately from the object being serialized), then converts VARINT
to use that approach, and then converts chain.h to the new framework (including
the new const-correct VARINT macro).

Commit message:

This adds the (internal) Wrapper class, and the Using function that uses it. Given
a class F that implements Ser(stream, const object&) and Unser(stream, object&)
functions, this permits writing e.g. READWRITE(Using<F>(object)).

This is a backport of Core PR17896 [1/3]
https://github.com/bitcoin/bitcoin/pull/17896/commits/ca62563df341786d1d1809a037d8b592924e78c4

Test Plan

ninja

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable