CDIndirectObjects.mesa (part of ChipNDale)
Copyright © 1986 by Xerox Corporation. All rights reversed.
Concept by Bertrand Serlet, November 8, 1985 11:34:29 am PST
Created by Christian Jacobi, February 12, 1986 6:50:17 pm PST
Last edited by Christian Jacobi, February 12, 1986 8:51:01 pm PST
DIRECTORY
CD USING [Instance, Object, ObjectClass, Design];
CDIndirectObjects: CEDAR DEFINITIONS =
BEGIN
Indirect objects introduce one level of indirection, so that users can store properties on indirect objects unnoticed by their source.
IsIndirect:
PROC [ob:
CD.Object]
RETURNS [
BOOL] =
INLINE {
RETURN [ ob.class=indirectClass ]
};
Indirectee:
PROC [indOb:
CD.Object]
RETURNS [
CD.Object] =
INLINE {
--peels of one layer of indirection
RETURN [IF indOb.class=indirectClass THEN NARROW[indOb.specificRef, CD.Instance].ob ELSE indOb]
};
CreateIndirect:
PROC [design:
CD.Design, pointOb:
CD.Object, reduce:
BOOL←
TRUE]
RETURNS [indOb:
CD.Object];
--creates an indirect object pointing to pointOb
--design: where pointOb already is and indOb will be included
ReduceIndirect:
PROC [design:
CD.Design, indOb:
CD.Object]
RETURNS [changed:
BOOL];
--get rid of multiple layers of indirection
--indOb will point to an object which is not an indirect object itself anymore
ChangeIndirect:
PUBLIC
PROC [design:
CD.Design, indOb:
CD.Object, pointNew:
CD.Object];
--changes indOb to be an indirection to pointNew
indirectClass: REF --READONLY-- CD.ObjectClass;
END.