Resurrect

The Resurrect function takes the flattened form of an instance and creates an MCollectible instance from it. The stream which is passed in contains the flattened form of the instance.

The context which is passed in is used in the same manner as in flattening, described earlier. For example, to resurrect the two instances created in the previous example:

      // Resurrect a single instance
      TPersistentClassA* A;
      TMemory aStream;
      A = (TPersistentClassA*) aStream.Resurrect();
      
      // Resurrect multiple instances from the same stream
      TPersistentClassD* D;
      TPersistentClassA* A;
      TMemory aStream;
      TContext aContext;
      if (!aStream>GetContext())
          aStream>SetContext(&aContext);
      D = (TPersistentClassD*) aStream.Resurrect(pneuma2);
      A = (TPersistentClassA*) aStream.Resurrect(pneuma2);
      if (aStream>GetContext() == &aContext)
          aStream>SetContext(NIL);
NOTE In the case of saving and restoring sets of instances, the order of resurrection must follow the order of flattening exactly.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker