Serialization Support Macros
The Essential Tools Module includes a number of macros which you must use to conveniently add serialization support to your classes. These macros expand to override the implementation of the
RWCollectable interface functions to suit the needs of your classes.
Serialization is supported by the following set of macros defined in
RWCollectable:
RW_DECLARE_ABSTRACT_COLLECTABLE_CLASS(USER_MODULE, ClassName) RW_DEFINE_ABSTRACT_COLLECTABLE_CLASS(USER_MODULE, ClassName) RE_DECLARE_COLLECTABLE_CLASS(USER_MODULE, ClassName) RW-DEFINE_COLLECTABLE_CLASS_BY_ID(USER_MODULE, ClassName, Id) RW_DEFINE_COLLECTABLE_CLASS_BY_NAME(USER_MODULE, ClassName, Str) These macros use the following tokens as parameters:
USER_MODULE is a special token for any custom macro name that you choose. It indicates the module in which the class is built, either your library or your program. To correctly export or import symbols between your libraries, no two modules should use the same token name. This is especially important in a multiple library environment.
ClassName is the name of the class in which the macro is used.
Id is the class ID used to identify the class.
Str is the string used to identify the class.
The only limitation on the naming of Id and Str is that each must be unique since they are used to identify a particular serializable type.
When you are creating a library that defines serialization types, you must ensure that the serialization support symbols introduced by the expansion of the macros are properly exported. In addition, the symbols must be properly imported into the programs that are built on top of the library.