Re: Multiple implementations of abstract interface with late binding

From: [at]} <gruntz{>
Date: Fri, 17 Sep 1999 21:59:07 +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.
This is one possibility. The other one is to specify an factory class
which has to be implemented by the module which implements
the given abstraction. The factory class should contain one or several
"New" methods, and should be installable using a procedure SetDir.
This procedure can assert, that no empty factory (i.e. NIL) is installed.
The factory then is available through a read-only variable. Examples
are FormModels, FormViews, etc., etc.

Sql and CommStreams however use another model.
> 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? How
> do I map the parameter strings?

If m and p are of type Meta.Item, then you can access a procedure
with e.g. the name "Open" as follows:

  Meta.Lookup(mod, m);
  IF m.obj = Meta.modObj THEN
       m.Lookup("Open", p);
       IF p.obj = Meta.procObj THEN

To call the procedure through the meta item, you have to read its value.
In order to do that, you have to define a meta value object first,

   v: RECORD (Meta.Value)
        Open: PROCEDURE (id, password, datasource: ARRAY OF CHAR; ........)
   END;

Then the procedure can be accessed using the method Getval of the meta
item. This only works if the signatures match.

    p.GetVal(v, ok);
    IF ok THEN
         v.Open(......); // execute the procedure


Hope, this is also of interest to the other members of the blackbox list.
Best wishes,

- Dominik

Dr. Dominik Gruntz
Oberon microsystems, Inc., Technoparkstrasse 1, CH-8005 Zurich
gruntz{([at]})nowhere.xy
tel ++41-1-445-1751
fax ++41-1-445-1752





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

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 - 22:06:57 UTC

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