First Change
Include the macros: RW_DECLARE_STREAMABLE_AS_SELF(), RW_DECLARE_STREMABALE_AS_BASE() (if your class needs to be streamed through pointers to base classes) and RW_DECLARE_STREAMABLE_POINTER() in this order in the header file for each class that is to be streamed as a pointer type. You will also have to include the RW_DECLARE_VIRTUAL_STREAM_FNS() macro described above inside the declaration of your class.
NOTE: The call can go in any header file, as long as it’s included before code that streams this class. Putting it in the header with the class declaration is the easiest way.
The following code shows real_property with this macro added.
 
// examples\serial\simple\real_property.h
 
class real_property
{
RW_DECLARE_VIRTUAL_STREAM_FNS(real_property)
 
public:
real_property () { }
 
real_property (const RWCString& address,
const RWCString& size)
:address_(address), size_(size) {
}
 
virtual ~real_property() { }
 
bool
operator== (const real_property&prop) const {
return address_ == prop.address_;
}
 
private:
RWCString address_;
RWCString size_;
};
 
RW_DECLARE_STREAMABLE_AS_SELF(real_property)
RW_DECLARE_STREAMABLE_POINTER(real_property) // 1
//1 Place these macros after the class declaration.
The first macro declares the class' factory (which allows objects to be created on the fly from the stream) when streaming objects through pointers to this class.
The second macro declares the operators operator<<(RWObjectOutputStream&, const real_property*) and operator>>(RWObjectInputStream&, real_property*&). These allow a pointer to a real_property to be written out, and a new real_property instance to be automatically created when the stream is read back in.