Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Object = PersistentObjects.Object;
CONST missingReset = 0; (* Reset must be called before switching mode *) CONST cannotReadHeader = 1; (* failed to read object header *) CONST invalidHeader = 2; (* corrupted/invalid object header *) CONST cannotReadObject = 3; (* failed to read object *) CONST unknownKey = 4; (* unknown key encountered *) CONST cannotWriteHeader = 5; (* failed to write object header *) CONST cannotWriteObject = 6; (* failed to write object *) CONST typeGuardFailure = 7; CONST errors = 8; TYPE ErrorCode = SHORTINT; (* missingReset.. *) TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) errorcode: ErrorCode; END; VAR error: Events.EventType; VAR errormsg: ARRAY errors OF Events.Message;
PROCEDURE Reset(s: Streams.Stream); PROCEDURE Read(s: Streams.Stream; VAR object: Object) : BOOLEAN; PROCEDURE GuardedRead(s: Streams.Stream; guard: Services.Type; VAR object: Object) : BOOLEAN; PROCEDURE Write(s: Streams.Stream; object: Object) : BOOLEAN;
LinearizedStructures works by attaching disciplines to the given stream and the objects being read. Reset allows to remove these disciplines and is required on switching from reading to writing and vice versa.
Please note that the objects must be read in the same order as they have been written before. It's wise to call Reset before and after a sequence of read and write operations and to avoid seek operations during saving/loading and stream positioning inside a group of objects.
Oberon || Library || Module Index || Search Engine || Definition || Module