Re: Multiple implementations of abstract interface with late binding

From: [at]} <pfister{>
Date: Fri, 17 Sep 1999 21:21:09 +0200

> My subject is multiple implementations of abstract interfaces with late
> binding. A good example is the CommStreams interface in BB. Now for
> every implementation of this abstract interface there needs to be some
> factory procedure defined, for example the NewListner procedure. In
> order to create an actual instance of the the abstract interface this
> factory procedure must be executed. This acutual factory object is
> identified by the driver parameter given to the abstract interface via a
> call to the abstract interface's create call.
>
> My question is, how do I code it using meta? I guess I can get the
> required procedure using Meta.LookupPath. But how do I execute it?

PROCEDURE NewStream* (protocol, localAdr, remoteAdr: ARRAY OF CHAR; OUT s:
Stream; OUT res: INTEGER);

  VAR ok: BOOLEAN; m, p: Meta.Item; mod: Meta.Name;

    v: RECORD (Meta.Value)

      p: StreamAllocator

    END;

BEGIN

  ASSERT(protocol # "", 20);

  res := noSuchProtocol;

  mod := protocol$; Meta.Lookup(mod, m);

  IF m.obj = Meta.modObj THEN

    m.Lookup("NewStream", p);

    IF p.obj = Meta.procObj THEN

      p.GetVal(v, ok);

      IF ok THEN v.p(localAdr, remoteAdr, s, res) END

    END

  END

END NewStream;

The above procedure is taken from CommStreams and shows how to use Meta for
this purpose.

With best regards


Cuno Pfister


Oberon microsystems, Inc.





--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy
Received on Fri Sep 17 1999 - 21:18:03 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:43 UTC