The first two virtual methods allow Graphcode to access Classdesc generated serialisation routines. Assuming you have declared a class foo as follows:
class foo: public object { ... virtual void lpack(pack_t *buf); virtual void lunpack(pack_t *buf); }
Then you may define the virtual functions as follows:
inline void pack(pack_t *,eco_string,foo&); inline void unpack(pack_t *,eco_string,foo&); inline void foo::lpack(pack_t *buf) {pack(buf,eco_string(),*this);} inline void foo::lunpack(pack_t *buf) {unpack(buf,eco_string(),*this);}
The definitions for pack(,,foo&)
and unpack(,,foo&)
will
then be created in the usual way by Classdesc.
It is important that pack(,,foo&)
and unpack(,,foo&)
be explicitly
declared before use, otherwise a default template function will be
linked in which will not work as expected. See the note on using
polymorphic objects under Classdesc.