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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_ADDR_WS,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5d224046a810970a,start X-Google-Attributes: gid103376,public From: Matt Brennan <"zschub"@hotmail. com> Subject: Redefining 'Class'Output Date: 1999/07/09 Message-ID: #1/1 X-Deja-AN: 498982168 Content-Transfer-Encoding: 7bit Organization: Vision Systems Ltd Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 NNTP-Posting-Date: Fri, 09 Jul 1999 15:50:35 EST Newsgroups: comp.lang.ada Date: 1999-07-09T00:00:00+00:00 List-Id: Hiya, I am trying to stream objects of various tagged types between two boxes. There are different compilers at each end with differing Ada.Tags.External_Tags. One compiler (GNAT) has an external representation the same as the Ada.Tags.Expanded_Name (defined by the language to be all capitals) and the other compiler uses the same string but all lower case. In order to guarantee compatibility at each end, i wish to redefine the 'Class'Output (and 'Class'Input) for my base type to use the (language defined) Expanded_Name in the stream rather than the external tag... like so: type Abstract_Command_Type is abstract tagged null record; procedure Abstract_Command_Type_Output ( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : in Abstract_Command_Type'Class); for Abstract_Command_Type'Class'Output use Abstract_Command_Type_Output; My problem is in completing the body of Abstract_Command_Type_Output. procedure Abstract_Command_Type_Output ( Stream : access Ada.Streams.Root_Stream_Type'Class; Item : in Abstract_Command_Type'Class) is begin String'Output ( Stream, Ada.Tags.Expanded_Name(Item'Tag))); -- How do I now 'Output the rest of the object... the formal -- Item only gives me its class... -- -- This won't work... ideas??? -- Abstract_Command_Type'Output (Stream, Item); end Abstract_Command_Type_Output; Perhaps you could suggest how I can complete this Output procedure to 'Output the rest of the object? Or comment on the sanity of overriding 'Class'Ouput and 'Class'Input. Beyond the problem of actually outputting the rest of the object, one issue I came across is that, if I extend the Abstract_Command_Type and do not further override 'Class'Output for the extension, I expect that I will inherit procedure Abstract_Command_Type_Output for my extension. Unfortunately, this does not seem to occur. For example: type Clock_Command_Type is new Abstract_Command_Type with record Data : Integer; end record; Command : Clock_Command_Type := ( Data => 4); Clock_Command_Type'Class'Output(, Command); This does not use Abstract_Command_Type_Output but rather the exisitng, compiler defined 'Class'Output generated for the extension Clock_Command_Type without reference to the redefinition for to use Abstract_Command_Type_Output. Any assistance would be great. Thanks, matt -- -- Matt Brennan || Vision Systems Ltd || +61 8 8300 4686 --