From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43b6c5f649185450 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-04 19:28:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-stoc.telia.net!news-stoa.telia.net!news.latnet.lv!news-stob.telia.net!telia.net!194.22.194.4.MISMATCH!masternews.telia.net.!newsc.telia.net.POSTED!not-for-mail From: David Holm Subject: Re: generic type identification Newsgroups: comp.lang.ada References: <_BAR9.4055$FF4.251139@newsb.telia.net> User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: Date: Sun, 05 Jan 2003 03:28:20 GMT NNTP-Posting-Host: 217.208.105.23 X-Complaints-To: abuse@telia.com X-Trace: newsc.telia.net 1041737300 217.208.105.23 (Sun, 05 Jan 2003 04:28:20 CET) NNTP-Posting-Date: Sun, 05 Jan 2003 04:28:20 CET Organization: Telia Internet Xref: archiver1.google.com comp.lang.ada:32559 Date: 2003-01-05T03:28:20+00:00 List-Id: James S. Rogers wrote: > > Another possibility is to create an abstract tagged type with one function > and > one procedure. The function will take a primitive (float, integer, etc.) > and convert it to the corresponding tagged type. The procedure will take > an instance of the tagged type and call the appropriate OpenGL binding. > > type GL_Binding is abstract tagged null record; > procedure Access_GL(Item : GL_Binding) is abstract; > > > Each package creating a concrete instance of the tagged type GL_Binding > would also define a function (basically a constructor) creating an > instance of that concrete tagged type from the appropriate scalar type. > > type GL_Integer_Binding is new GL_Binding with record > Value : Integer; > end record; > > procedure Access_GL(Item : GL_Integer_Binding); > function Create(Item : Integer) return GL_Integer_Binding; > > Do this for each numeric type you need to bind. > Calling the appropriate binding is then very simple. > > Pixel_Location : Integer; > Access_GL(Create(Pixel_Location)); > > Jim Rogers In this case I'd rather create a couple of overloaded procedures as the idea of the thick binding is to make it easier to access OpenGL from Ada. This method would just make it harder since it would require one extra call for each time you pass values to OpenGL. //David Holm