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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,740e91341085efe3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: defaultuserbr@yahoo.com Newsgroups: comp.lang.ada Subject: Re: Some help for a C++ guy Date: 8 Apr 2005 08:55:09 -0700 Organization: http://groups.google.com Message-ID: <1112975709.395996.258940@f14g2000cwb.googlegroups.com> References: <1112912062.146885.324110@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 130.76.96.19 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1112975715 13693 127.0.0.1 (8 Apr 2005 15:55:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 8 Apr 2005 15:55:15 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=130.76.96.19; posting-account=jWLFKg0AAAA9UYjCwxeOEw3zdPk7tNz5 Xref: g2news1.google.com comp.lang.ada:10339 Date: 2005-04-08T08:55:09-07:00 List-Id: 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