links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 12:02 pm UTC on 12 January 2019

Instance variables

 structures 	Dictionary of (#Rectangle ->#(classVersionInteger 'origin' 'corner')).  Inst 
 				var names are strings.
 steady 		Set of Classes who have the same structure now as on the incoming file.
 				Includes classes with same inst vars except for new ones added on the end.
 reshaped 	Dictionary of Classes who have a different structure now from the incoming file.  
 				Includes those with same inst vars but new version number.
				(old class name - method selector to fill in data for version to version)

renamed	        Dictionary of Classes who have a different name.  Make an instance of the new
			class, and send it the conversion call.
				(old class name symbol ->new class name).  
 renamedConv	Dictionary of conversion selector for Classes who have a different name.
				(old class name symbol - conversion selector).
 topCall		Tells if next or nextPut: are working on the top object in the tree.  
			nil if outside, the top object if deep inside.

The core of saving an object called 'theObject' (and its subobjects) with a SmartRefStream is

  srefStream := SmartRefStream on: theObject.
  srefStream nextPut: theObject.  "and all subobjects"
  srefStream close.		"also closes me"


Class comment:

OrdinaryReferenceStreams assume that the inames and order of instance variables/i/span is exactly the same when an object file is written and read.
SmartRefStream allows object files to be read even after iinstance variables have changed/i or the entire iclass has been renamed/i.

When an object file is written, no one knows how the classes will change in the future. Therefore, all conversion must be done when the file is read. The key is to store enough information in the file about the names of the instance variables of all outgoing classes.

SmartRefStream works best with only one tree of objects per file. You can nextPut: more than once, but each object tree gets its own class structure description, which is big.

Conversion of old objects is done by a method

seeSmartRefStream conversion methods–Ted Kaehler and Bob Arning.

What does SmartRefStream write out / Help for debugging

The SmartRefStream deals with

Mariano Martinez Peck 1, Noury Bouraqadi, Stéphane Ducasse, Luc FabresseObject Swapping Challenges - an Evaluation of ImageSegment_

See also