Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
Forwarders


NAME

Forwarders - forward abstractions through filter objects

SYNOPSIS

TYPE Object = Services.Object;
TYPE ForwardProc = PROCEDURE (from, to: Object);


PROCEDURE Register(for: ARRAY OF CHAR; forward: ForwardProc); PROCEDURE RegisterObject(object: Object; forward: ForwardProc); PROCEDURE Update(object: Object; forward: ForwardProc); PROCEDURE Forward(from, to: Object);

DESCRIPTION

Forwarders supports the registration of abstractions which are able to forward their operations through filter objects. A filter object delegates all operations of the associated main abstraction in a possibly modified form. Usually, filters are not aware of all auxiliary abstractions, and, on the other side, auxiliary abstractions do not notice the creation of filter objects.

Each auxiliary abstraction (i.e. an abstraction which does not depend on a static type extension) should register its notification procedure with Register. If the auxiliary abstraction may be applied to all extensions of Services.Object, "" is to be passed to for. Otherwise a valid type name which has been earlier passed to Services.CreateType or Services.InitType may be given to for. In this case, forward gets only called if both objects, from and to, are extensions of that type.

RegisterObject may be called instead of Register if specific objects are supported only and not all objects which are an extension of a specific type. This is useful if an auxiliary abstraction is available on request only.

Update may be called by auxiliary abstractions when an interface gets newly installed or changed in a way which requires forward to be called again for all dependants of object. Note that Update unlike Register does not assure that the objects passed to forward will be of a specific extension.

Each module which acts as a filter should call Forward for each created filter object. from is the filter object and to the object where the operations of the main abstraction are delegated to. Note that Forward calls Resources.DependsOn to register the dependency. The dependency relation between from and to will be automatically removed if either from or to terminates.

DIAGNOSTICS

Some errors are caught by assertions:

SEE ALSO

Resources
notification of state changes and management of dependency relations
Services
type system of the library

Edited by: borchert, last change: 1995/03/20, revision: 1.1, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module