Methods Called for Objects During Archiving and Dearchiving

During dearchiving, the following steve language types are automatically saved and restored: int, float, string, list, hash, data. The pointer type is not automatically restored. The object type is restored only if the other object was dearchived from the same archive. If an object to be archived contains only the types which are automatically saved and restored, no further action is required to prepare the objects for saving and loading.

For objects which do contain either pointer or object types, data will need to be carefully encoded and decoded. The special methods archive and dearchive are called automatically during archiving and dearchiving respectively. The "archive" method should be implemented, if necessary, to prepare a user object for archiving. The "dearchive" method should be implemented, if necessary, after an object has been archived to prepare it for being loaded into a simulation.

For many users, these methods are not required and should not be implemented. If they are implemented, however, they must return 1 to indicate success and unless the methods are specifically intended to override superclass behaviors, they must call the superclass implementation. In most cases, it is desirable to return the same value as the superclass implementation so that errors are handled correctly. Example archive and dearchive methods are shown below. These methods do no special preparation for archiving and dearchiving, but instead fulfill the requirements listed above and print a message.

+ to archive:
        print "Archiving $self...".

        return (super archive).

+ to dearchive:
        print "Dearchiving $self...".

        return (super dearchive).