comp.lang.ada
 help / color / mirror / Atom feed
From: defaultuserbr@yahoo.com
Subject: Re: Some help for a C++ guy
Date: 8 Apr 2005 08:55:09 -0700
Date: 2005-04-08T08:55:09-07:00	[thread overview]
Message-ID: <1112975709.395996.258940@f14g2000cwb.googlegroups.com> (raw)
In-Reply-To: <dYidnVI1vrZrlsvfRVn-1w@comcast.com>


tmoran@acm.org wrote:

> >What I'd like is to have some sort of array of the messages. That
way
> >for errors. I guess I'm thinking an OO approach, as long as the
various
> >members could be passed as arguments to the registration routines.
>   Since the generic has no parameters, what you're getting is in
effect
> a single body of code, with separate data for each instantiation, and
> you call
>   Message_0_Handler.Message_Callbacks (Status);
> instead of
>   Message_Handler.Message_Callbacks (Message_0, Status);
>
> So you could just drop the "generic" and put the package's local data
> into a record:

To tell the truth, there probably should be some sort of parameter.
Each message has a unique message ID that really should be carried in
the package/class/whatever.

>  package Message_Handler is
>
>     type Message_State_Type is private;
>
>     procedure Message_Callback (State  : in Message_State_Type;
>                                 Status : in M1553.IO_Status_T);
>  ...
>     function Num_Message_Callbacks (State  : in Message_State_Type)
>     return OS_Types.Unsigned_Word;
>  ...
>     -- make Data_Buf_Ptr readable, but not writeable
>     function Data_Buf_Ptr (State  : in Message_State_Type)
>     return M1553.Data_Buf_VPtr_T;
>
>     function Stat_Buf_Ptr (State  : in Message_State_Type)
>     return M1553.Status_Buf_VPtr_T;
>  ...
>
> Then you could have
>     Message_List : array(0 .. 5) of Message_State_Type;
> and call
>     Message_Handler.Message_Callback (Message_List(0), Status);
>     etc
> That seems the most vanilla change, and you can probably change all
> your source code by a simple macro in your editor.
> Or am I missing something?

Ok, I'll take a look at this. Thanks for taking the time to write this
up. I know it's somewhat frustrating to have people who don't really
know your language that well come in with some problem to solve, people
who can't barely articulate what they want to do and what problems they
are having. I appreciate all the input so far.



Brian




  reply	other threads:[~2005-04-08 15:55 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
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 [this message]
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