Serialization Requirements
The first step is to identify the classes that need to support serialization. These are:
*the classes for any objects to be serialized, either by value or as a pointer
*both the base and the derived class for objects to be serialized as a pointer to the base class
If you are using any of the collection classes in the Essential Tools Module, most of these already support serialization. Check the class description in the SourcePro API Reference Guide to be sure, looking for global insertion and extraction operators that save the collection to an output stream and restore it from an input stream.
For the real estate application, you’ll need to add serialization support to real_property, the base class, and to its derived classes residential and rural_land. You do not need to modify the vector collection class, RWTPtrOrderedVector, because it already supports serialization.
To add serialization support to classes:
1. Add an explicitly declared default constructor to any class that does not already have one.
2. Declare the streamContents() function by putting a macro in the header file for each class. If serializing pointers to objects rather than objects by value, add an additional macro to declare global operators for serializing pointers.
3. Define the streamContents() function by putting macros in the source file for each class. If serializing pointers to objects rather than objects by value, add additional macros to define the global operators for serializing pointers.