Implement the Ser and Unser methods needed for implementing a formatter (see Using below).

Synopsis

Declared in <serialize.h>

#define FORMATTER_METHODS(cls, obj)

Description

Both Ser and Unser are delegated to a single static method SerializationOps, which is polymorphic in the serialized/deserialized type (allowing it to be const when serializing, and non‐const when deserializing).

Example use: struct FooFormatter { FORMATTER_METHODS(Class, obj) { READWRITE(obj.val1, VARINT(obj.val2)); } } would define a class FooFormatter that defines a serialization of Class objects consisting of serializing its val1 member using the default serialization, and its val2 member using VARINT serialization. That FooFormatter can then be used in statements like READWRITE(Using<FooFormatter>(obj.bla)).

Parameters

Name

Description

cls

The class whose objects the formatter serializes.

obj

The name bound to the object inside the generated method body.

Created with MrDocs