OpenEnroth 73e68f7
|
Macros | |
#define | MM_DECLARE_RAW_PRIVATE_BASE(BASE) |
Functions | |
template<RawAccessible T1, class T2 > | |
void | snapshot (const T1 &src, T2 *dst) |
template<class T1 , RawAccessible T2> | |
void | reconstruct (const T1 &src, T2 *dst) |
#define MM_DECLARE_RAW_PRIVATE_BASE | ( | BASE | ) |
Helper macro for classes that want to keep their members private, while allowing for external snapshot
/ reconstruct
functions.
The way to make this work is:
Class
and RawClass
.RawClass
exposes all the members as public fields.Class
uses private inheritance to derive from RawClass
and uses MM_DECLARE_RAW_PRIVATE_BASE(RawClass)
inside the class definition.snapshot
and reconstruct
functions are written for the RawClass
.snapshot
and reconstruct
also work for Class
by forwarding to the overloads for RawClass
.Example code:
void reconstruct | ( | const T1 & | src, |
T2 * | dst | ||
) |
void snapshot | ( | const T1 & | src, |
T2 * | dst | ||
) |