The format used for dumping objects to files an loading them back in
involves two passes. The first pass lists all of the objects to be
saved (i.e., the object that the Save
function was called on, and
any sub-objects it owns. This is done so that during loading, all
objects will have been created before pointers to these objects attempt
to be cashed out. The second pass then saves all of the values
associated with the members in the object. The format is a name-value
based one, so that files can be loaded back into objects whose
definition has changed. It skips member names it can't find, etc, so
you can continue to modify your software and still load old data.
Paths (i.e., the GetPath
function) figure heavily into the saving
of objects, especially pointers. Pointers are saved by giving the path
to the object. These saved paths are automatically corrected if the
objects are loaded into a different location than the one they were
saved in. All pointers that are saved are assumed to be
reference-counter based. Thus, the SetPointer
function is used
to set the pointer. Also note that it is impossible to save a pointer
to a non-taBase derived object, since there is no way to get the path of
such an object.