Define rwSaveGuts and rwRestoreGuts
Now you must add to one and only one source file the global functions rwSaveGuts() and rwRestoreGuts(), which will be used to save and restore the internal state of your class. These functions are called by the operator<< and operator>> that were declared and defined as discussed in Add RW_DECLARE_PERSISTABLE to Your Header File and Add RW_DEFINE_PERSISTABLE to One Source File above.
Note: Writing rwSaveGuts and rwRestoreGuts Functions provides guidelines about how to write rwSaveGuts() and rwRestoreGuts() global functions.
*For non-templatized classes, define the following functions:
 
void rwSaveGuts(RWFile& f, const YourClass& t){/* ...*/}
void rwSaveGuts(RWvostream& s, const YourClass& t) {/* ...*/}
void rwRestoreGuts(RWFile& f, YourClass& t) {/* ...*/}
void rwRestoreGuts(RWvistream& s, YourClass& t) {/* ...*/}
*For templatized classes with a single template parameter T, define the following functions:
 
template<class T> void
rwSaveGuts(RWFile& f, const YourClass<T>& t){/* ...*/}
template<class T> void
rwSaveGuts(RWvostream& s, const YourClass<T>& t) {/* ...*/}
template<class T> void
rwRestoreGuts(RWFile& f, YourClass<T>& t) {/* ...*/}
template<class T>void
rwRestoreGuts(RWvistream& s, YourClass<T>& t) {/* ...*/}
*For templatized classes with more than one template parameter, define rwRestoreGuts() and rwSaveGuts() with the appropriate number of template parameters.
Function rwSaveGuts() saves the state of each class member necessary for persistence to an RWvostream or an RWFile. If the members of your class can be persisted (see Table 2 above), and if the necessary class members are accessible to rwSaveGuts(), you can use operator<< to save the class members.
Function rwRestoreGuts() restores the state of each class member necessary for persistence from an RWvistream or an RWFile. Provided that the members of your class are types that can be persisted, and provided that the members of your class are accessible to rwRestoreGuts(), you can use operator>> to restore the class members.