Universität Ulm, Fakultät für Mathematik und Wirtschaftswissenschaften, SAI

WS 97/98 || Entwicklung objekt-orientierter Bibliotheken || Beispiele || Collections-13

DEFINITION PrintableObjects


DEFINITION PrintableObjects;

   IMPORT Disciplines, Streams;

   (* secondary abstraction for printable objects
      which is usually to be supported directly by the primary implementation
   *)

   TYPE
      PrintProc = PROCEDURE (s: Streams.Stream; object: Disciplines.Object);

   PROCEDURE Init(object: Disciplines.Object; print: PrintProc);
      (* assign a print method to an object;
	 usually called by the creator of `object'
	    (i.e. the primary implementation)
      *)

   PROCEDURE SetDefault(s: Streams.Stream; default: ARRAY OF CHAR);
      (* sets the per-stream default output text for objects
	 which do not have an associated print method
      *)

   PROCEDURE Print(s: Streams.Stream; object: Disciplines.Object);
      (* call the print method of `object', or, if not present,
	 the per-stream default text, or, if not present, a question mark
      *)

END PrintableObjects.

WS 97/98 || Entwicklung objekt-orientierter Bibliotheken || Beispiele || Collections-13

Andreas Borchert, 6. Dezember 1997