comp.lang.ada
 help / color / mirror / Atom feed
From: defaultuserbr@yahoo.com
Subject: Re: Some help for a C++ guy
Date: 8 Apr 2005 10:49:17 -0700
Date: 2005-04-08T10:49:17-07:00	[thread overview]
Message-ID: <1112982557.068751.125740@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: <x7vk6ndlsve.fsf@smaug.pushface.org>


Simon Wright wrote:


> It sounds from your original question as though you want to use
tagged
> types, roughly the equivalent of classes & inheritance in C++.

Here's my current attempt:

with MIL_STD_1553;
with OS_Types;

package Message_Handler is

   package M1553 renames MIL_STD_1553;

   type Handler is
      tagged record
         Data_Buf_Ptr   :  M1553.Data_Buf_VPtr_T := new M1553.Data_Buf;
         Stat_Buf_Ptr   :  M1553.Status_Buf_VPtr_T :=
           new M1553.Status_Buf_T;
      end record;


      -- the following are the primitive operations of the type
      procedure Message_Callback (Status : in M1553.IO_Status_T);

      function Num_Message_Callbacks return OS_Types.Unsigned_Word;

      function Num_Errors return OS_Types.Unsigned_Word;


end Message_Handler;

That compiles OK. In the client test package, I have:

with Message_Handler;

pragma Elaborate_All(Message_Handler);

   Handlers : Array (0..1) of Message_Handler.Handler;

That's all good too.

However, the first place that uses something from Message_Handler:

      Callbacks := Handlers(0).Num_Message_Callbacks;

Fails to compile, with an error message:

no selector "Num_Message_Callbacks" for type Handler defined at
message_handler.ads


So obviously I'm either defining things wrong or using what I have
defined incorrectly.



Brian




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