comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Some help for a C++ guy
Date: Fri, 08 Apr 2005 17:20:01 -0500
Date: 2005-04-08T17:20:01-05:00	[thread overview]
Message-ID: <Ttqdnflhs9cMnsrfRVn-gg@comcast.com> (raw)
In-Reply-To: 1112993665.945046.278360@f14g2000cwb.googlegroups.com

>That's a problem because that callback subroutine needs to be passed to
>a function expecting some of the type BC_Completion_Handler_T, defined
>as:
>
>   type BC_Completion_Handler_T is access
>      procedure (Status : in IO_Status_T);
>
>Changing the that type would then break a bunch of other code.

So you need to specify for a callback the particular Message_* that
it pertains to?  Just make a set of wrapper routines:
    procedure Message_0_Completion_Handler(Status : in IO_Status_T) is
    begin
      Completion_Handler(Message(0), Status);
    end Message_0_Completion_Handler;
etc.

and register the specific Message_*_Completion_Handler procedures.
I presume this registration is done once so even if you add a new
Message_237_Completion_Handler it's a minor addition to a single package.

I'm presuming you want to make small changes to the existing code.
If you want to use tagged types you are contemplating larger architectural
changes.  In your current code, "registering a callback" means essentially
"note a particular routine, and a particular Message_n's data for future
use".  Passing an explicit tagged Handler parameter accomplishes the
"note a particular Message_n's data" part.  If the particular routine
is not in fact dynamic, but always BC_Completion_Handler, then instead
of registering the procedure callback you want to register the Message_n
data and always call BC_Completion_Handler(Registered_Message, Status);



  reply	other threads:[~2005-04-08 22:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-07 22:14 Some help for a C++ guy defaultuserbr
2005-04-07 22:51 ` Ed Falis
2005-04-07 23:18   ` defaultuserbr
2005-04-07 23:32     ` Ed Falis
2005-04-08 15:41       ` defaultuserbr
2005-04-08  5:50     ` Simon Wright
2005-04-08 15:47       ` defaultuserbr
2005-04-08 17:49       ` defaultuserbr
2005-04-08 20:42         ` tmoran
2005-04-08 21:18           ` defaultuserbr
2005-04-08 20:54         ` defaultuserbr
2005-04-08 22:20           ` tmoran [this message]
2005-04-08 23:03             ` defaultuserbr
2005-04-09  0:19               ` tmoran
2005-04-09 15:17                 ` defaultuserbr
2005-04-08  4:43 ` tmoran
2005-04-08 15:55   ` defaultuserbr
2005-04-09 22:20     ` Matthew Heaney
replies disabled

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