comp.lang.ada
 help / color / mirror / Atom feed
From: "REH" <spamjunk@stny.rr.com>
Subject: Re: generics in Ada 83
Date: 13 Sep 2005 15:44:11 -0700
Date: 2005-09-13T15:44:11-07:00	[thread overview]
Message-ID: <1126651451.717028.253340@z14g2000cwz.googlegroups.com> (raw)
In-Reply-To: <FcIVe.5$Fv6.3@dfw-service2.ext.ray.com>


Jeffrey Carter wrote:
> Then you're in good shape. 1st, define your complete generic for using
> the synchronous send feature:
>
> generic -- Client_Server_With_Synchronous_Send
>     type Header_Type is private;
>
>     -- many formal subprograms
> package Client_Server_With_Synchronous_Send is
>     procedure Op (Header : in out Header_Type);
>
>     ...
> end Client_Server_With_Synchronous_Send;
>
> then define your shorter generic:
>
> generic -- Client_Server
>     type Header_Type is private;
>
>     with function Get_Length(Header : in Header_Type) return Integer;
>
>     with procedure Set_Length(Header : in out Header_Type;
>                               Length : in Integer);
> package Client_Server is
>     -- presumably a smaller set of operations than
>     -- Client_Server_With_Synchronous_Send
>     procedure Op (Header : in out Header_Type);
>
>     ...
> end Client_Server;
>
> Now, the body of Client_Server instantiates
> Client_Server_With_Synchronous_Send and implements its operations in
> terms of Client_Server_With_Synchronous_Send's operations:
>
> with Client_Server_With_Synchronous_Send;
> package body Client_Server is
>     -- Define stub subprograms for instantiation here.
>
>     package Synchronous is new Client_Server_With_Synchronous_Send
>        (Header_Type => Header_Type,
>         Get_Length  => Get_Length,
>         Set_Length  => Set_Length, ...);
>
>     procedure Op (Header : in out Header_Type) renames Synchronous.Op;
> 
>     ...
> end Client_Server;
> 

Thank you; much appreciated.

REH




  reply	other threads:[~2005-09-13 22:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-13 13:26 generics in Ada 83 REH
2005-09-13 13:30 ` Georg Bauhaus
2005-09-13 16:25   ` REH
2005-09-13 19:23     ` Georg Bauhaus
2005-09-13 13:50 ` Martin Dowie
2005-09-13 16:30   ` REH
2005-09-13 16:41     ` Martin Dowie
2005-09-13 18:43       ` REH
2005-09-13 19:37         ` Ludovic Brenta
2005-09-13 19:53           ` REH
2005-09-13 16:56 ` Jeffrey Carter
2005-09-13 18:53   ` REH
2005-09-13 22:16     ` Jeffrey Carter
2005-09-13 22:44       ` REH [this message]
2005-09-14  8:14   ` Jean-Pierre Rosen
2005-09-14 12:40     ` REH
2005-09-14 13:15     ` Hyman Rosen
2005-09-14 14:08       ` Jean-Pierre Rosen
2005-09-14 15:23         ` Hyman Rosen
2005-09-14 15:41           ` Robert A Duff
2005-09-19 17:58             ` REH
2005-09-20  4:58               ` Hyman Rosen
2005-09-20 12:36                 ` REH
2005-09-20  1:34             ` adaworks
2005-09-20  4:14               ` Jim Rogers
2005-09-21 22:58               ` Robert A Duff
2005-09-22 15:18                 ` adaworks
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox