Example defobj/Serialization/-lispStoreIntegerArray:Keyword:Rank:Dims:Stream:/1.
- (void)lispOutDeep: stream
{
[stream catStartMakeInstance: "Attribute"];
[super lispOutVars: stream deep: NO]; //saves all ints, doubles, BOOLs, and static arrays. Saves the values of all other objects as nil
// Note one can use the previous "lispSaveStream:..." methods to
// customize the choice of variables to be saved.
// Now save an array called "culture", which has 1 row
// and "numDims" columns, onto the stream.
[super lispStoreIntegerArray: culture Keyword: "culture" Rank: 1 Dims: &numDims Stream: stream];
[stream catEndMakeInstance];
} |
Example defobj/Serialization/-lispSaveStream:Boolean:Value:/1.
- (void)lispOutDeep: stream
{
[stream catStartMakeInstance: "BFagent"];
[self lispSaveStream: stream Double: "demand" Value: demand];
[self lispSaveStream: stream Double: "profit" Value: profit];
[self lispSaveStream: stream Double: "wealth" Value: wealth];
[self lispSaveStream: stream Double: "position" Value: position];
[self lispSaveStream: stream Double: "cash" Value: cash];
[self lispSaveStream: stream Double: "price" Value: price];
[self lispSaveStream: stream Double: "dividend" Value: dividend];
[self lispSaveStream: stream Integer: "myID" Value: myID];
[stream catEndMakeInstance];
}
An example of such a usage can be found in version 2.4 of the
Artificial Stock Market (http://ArtStkMkt.sourceforge.net). |