From: "David Botton" <David@Botton.com>
Subject: Re: friend classes in ada95
Date: 2000/04/17
Date: 2000-04-17T00:00:00+00:00 [thread overview]
Message-ID: <KpLK4.3403$wy1.6682475@news-east.usenetserver.com> (raw)
In-Reply-To: 8df6fb$mm3$1@nnrp1.deja.com
The format / approach of the tagged type doesn't matter to me. It is the
interfaces format that matters.
What I would like to do would look something like this in today's Ada with a
twist:
-- Interface IUnknown
type IUnknown is abstract tagged null record;
-- I like the prefix idea so I would use: interface type IUnknown;
type PUnknown is access all IUnknown;
function QueryInterface (This : IUnknown, etc ...) return Interfaces.C.long
is abstract;
pragma Convention (C, QueryInterface);
function AddRef (This : IUnknown) return Interfaces.C.unsigned is abstract;
pragma Convention (C, AddRef);
function Release (This : IUnknown) return Interfaces.C.unsigned is
abstract;
pragma Convention (C, Release);
-- Interface IBeep
type IBeep is new abstract IUnknown with null record;
-- I want to be able to extend interface definitions so I need something
that does this
-- I would put here: interface type IBeep is new IUnknown;
type PBeep is access all IBeep;
function Beep (This : IBeep) return Interfaces.C.unsigned is abstract;
pragma Convention (C, Beep);
-- Interface IMessage
type IMessage is new abstract IUnknown with null record;
type PMessage is access all IMessage;
function Message (This : IMessage) return Interfaces.C.unsigned is abstract;
pragma Convention (C, Beep);
type Beep_Class is tagged
-- class type Beep_Class is would be so much nicer here.
-- Some how designate that Beep_Class implements IBeep and IMessage say with
the interface section I mentioned like:
-- Interface
-- IBeep, IMessage
record
Ref_Count : Interfaces.C.long;
end record;
-- Implements IUnknown for both IBeep and IMessage
function QueryInterface (This : Beep_Class, etc ...) return
Interfaces.C.long;
function AddRef (This : Beep_Class) return Interfaces.C.unsigned;
function Release (This : Beep_Class) return Interfaces.C.unsigned;
-- Implements IBeep
function Beep (This : Beep_Class) return Interfaces.C.unsigned;
-- Implements IMessage
function Message (This : IMessage) return Interfaces.C.unsigned;
The I could do:
P1 : PUnknown := new Beep_Class;
P2 : PMessage := PMessage (P1);
P3 : PBeep := PBeep (P1);
hr := AddRef (P1);
hr := Beep (P2);
etc.
I would then make P1 guts look like a pointer to:
record
QueryInterface : System.Address;
AddRef : System.Address;
Release : System.Address;
Object : System.Address;
end record;
P2 like
record
QueryInterface : System.Address;
AddRef : System.Address;
Release : System.Address;
Beep : System.Address;
Object : System.Address;
end record;
etc.
Or comething like that where I could pass a pointer to a clean table of
functions. and still get back to my object when needed. The layout of
Beep_Class doesn't matter to me.
David Botton
Robert Dewar <robert_dewar@my-deja.com> wrote in message
news:8df6fb$mm3$1@nnrp1.deja.com...
> > On Win32 I would implement the interfaces using the same
> > "vtbl" style used by MSVC++ and therefore COM.
>
> Well tagged types use this *identical* implementation approach
> so I really can't understand the distinction you are trying
> to make here.
next prev parent reply other threads:[~2000-04-17 0:00 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-14 0:00 friend classes in ada95 Stefan Folkesson
2000-04-14 0:00 ` swhalen
2000-04-14 0:00 ` Florian Weimer
2000-04-14 0:00 ` Stefan Folkesson
2000-04-14 0:00 ` Julian Day
2000-04-14 0:00 ` Steve Folly
2000-04-14 0:00 ` Robert A Duff
2000-04-17 0:00 ` John J. Rusnak
2000-04-18 0:00 ` Vincent Marciante
2000-04-18 0:00 ` John Rusnak
2000-04-18 0:00 ` Steve Folly
2000-04-14 0:00 ` John J. Rusnak
2000-04-15 0:00 ` Jeff Carter
2000-04-16 0:00 ` Robert Dewar
2000-04-16 0:00 ` David Botton
2000-04-17 0:00 ` Robert Dewar
2000-04-17 0:00 ` David Botton
2000-04-17 0:00 ` David Botton [this message]
2000-04-18 0:00 ` friend classes in ada95 (long) tmoran
2000-04-18 0:00 ` David Botton
2000-04-18 0:00 ` friend classes in ada95 Stanley R. Allen
2000-04-19 0:00 ` MI, was " tmoran
2000-04-19 0:00 ` David Botton
2000-04-19 0:00 ` friend classes in ada95 (long) Brian Rogoff
2000-04-19 0:00 ` David Botton
2000-04-19 0:00 ` Hyman Rosen
2000-04-19 0:00 ` Brian Rogoff
2000-04-23 0:00 ` Hyman Rosen
2000-04-23 0:00 ` Brian Rogoff
2000-04-24 0:00 ` Hyman Rosen
2000-04-25 0:00 ` Brian Rogoff
2000-04-25 0:00 ` Ole-Hjalmar Kristensen
2000-04-18 0:00 ` friend classes in ada95 Geoff Bull
2000-04-18 0:00 ` David Botton
2000-04-18 0:00 ` Jean-Pierre Rosen
2000-04-18 0:00 ` tmoran
2000-04-18 0:00 ` John J. Rusnak
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Geoff Bull
2000-04-19 0:00 ` David Botton
2000-04-19 0:00 ` Robert Dewar
2000-04-20 0:00 ` Geoff Bull
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Ehud Lamm
2000-04-19 0:00 ` Jeff Susanj
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Jeff Carter
2000-04-19 0:00 ` Ray Blaak
2000-04-20 0:00 ` Jean-Pierre Rosen
2000-04-20 0:00 ` Ray Blaak
2000-04-20 0:00 ` Jean-Pierre Rosen
2000-04-24 0:00 ` Ray Blaak
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Brian Rogoff
2000-04-20 0:00 ` Jean-Pierre Rosen
2000-04-20 0:00 ` BSCrawford
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Ray Blaak
2000-04-20 0:00 ` Charles Hixson
2000-04-21 0:00 ` Jean-Pierre Rosen
2000-04-29 0:00 ` Aidan Skinner
2000-04-29 0:00 ` Robert I. Eachus
2000-04-21 0:00 ` Jon S Anthony
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Jeff Carter
2000-04-21 0:00 ` Robert Dewar
2000-04-21 0:00 ` Jon S Anthony
2000-04-22 0:00 ` Robert Dewar
2000-04-21 0:00 ` Ken Garlington
2000-04-19 0:00 ` Bill Greene
2000-04-19 0:00 ` tmoran
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Jean-Pierre Rosen
2000-04-18 0:00 ` John Rusnak
2000-04-19 0:00 ` Robert Dewar
2000-04-18 0:00 ` Pascal Obry
2000-04-18 0:00 ` David Botton
2000-04-16 0:00 ` Jeff Carter
2000-04-16 0:00 ` David Botton
2000-04-17 0:00 ` Robert Dewar
2000-04-17 0:00 ` Hyman Rosen
2000-04-17 0:00 ` Robert Dewar
2000-04-17 0:00 ` Robert I. Eachus
2000-04-18 0:00 ` Robert Dewar
2000-04-19 0:00 ` Robert I. Eachus
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Ray Blaak
2000-04-23 0:00 ` Robert I. Eachus
2000-04-19 0:00 ` Alfred Hilscher
2000-04-19 0:00 ` Ray Blaak
2000-04-19 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox