Source File Changes
Moving on to the source files, you must now:
*Define the streamContents() function using the following macro set:
*RW_BEGIN_STREAM_CONTENTS(className)
*RW_STREAM_PARENT(parentClass)
*RW_STREAM_ATTR_MEMBER(variableLabel,variableName)
*RW_END_STREAM_CONTENTS()
The definitions generated through these macros guarantee symmetry between the serialization output and input operations.
*Define the global insertion and extraction operators that support the serialization of pointers to objects, using the following macro set:
*RW_DEFINE_STREAMABLE_POINTER(className)
Apply this macro to all classes involved in the serialization.
*RW_DEFINE_STREAMABLE_AS_SELF(className)
Apply this macro to a class if its instantiations will be serialized as pointers directly to the instantiations.
*RW_DEFINE_STREAMABLE_AS_BASE(derivedClass,baseClass)
Apply this macro to a class derived from a base class if its instantiations will be serialized as pointers to the base class.
If you want to allow for the possibility that these objects might be serialized as pointers directly to themselves, you need to apply RW_DEFINE_STREAMABLE_AS_SELF as well. In the code that follows, both RW_DEFINE_STREAMABLE_AS_BASE and RW_DEFINE_STREAMABLE_AS_SELF are applied.
Here is the source code for your three classes, modified as needed with the macros described above:
 
// from real_property.cpp
 
RW_BEGIN_STREAM_CONTENTS(real_property) //1
{
RW_STREAM_ATTR_MEMBER(address, address_) //2
RW_STREAM_ATTR_MEMBER(size, size_)
}
RW_END_STREAM_CONTENTS //3
//1 Begins the streamContents() function definition for the class real_property.
//2 Generates the code for the streaming of the address_ variable. The first argument can be anything, but clearly something close to the variable name is preferable. The second argument must be the exact variable name.
//3 Ends the streamContents() function definition.
 
// from residential.cpp
 
RW_BEGIN_STREAM_CONTENTS(residential)
{
RW_STREAM_PARENT(real_property) //1
RW_STREAM_ATTR_MEMBER(footage, footage_) //2
}
RW_END_STREAM_CONTENTS
 
//1 Generates the code for the streaming of variables inherited from the parent class. This macro must appear immediately after the RW_BEGIN_STREAM_CONTENTS macro.
//2 Generates the code for the streaming of the footage_ variable, which is an extension to the variables in the base class.
Note that the code below parallels the code for residential.
 
// from rural_land.cpp
RW_BEGIN_STREAM_CONTENTS(rural_land)
{
RW_STREAM_PARENT(real_property)
RW_STREAM_ATTR_MEMBER(irrigation, irrigation_)
}
RW_END_STREAM_CONTENTS