comp.lang.ada
 help / color / mirror / Atom feed
* generic question
@ 2006-11-19 18:03 markww
  2006-11-19 19:17 ` Ludovic Brenta
                   ` (3 more replies)
  0 siblings, 4 replies; 37+ messages in thread
From: markww @ 2006-11-19 18:03 UTC (permalink / raw)


Hi,

I've been going through ada tutorials, and am looking at the generics
support. I can't quite understand how to accomplish having a record
which has a generic data member. For example, something like:

    type NODE_REC is
        record
            unknown_data_type : generic;  -- not sure how to express
this in ada
            Next_Node : NODE_REC_PTR;
            Prev_Node : NODE_REC_PTR;
      end record;

I'd like to be able to store either an integer, a float, or some other
user defined record type in there so that this node record becomes a
container. Is this possible?

Thanks,
Mark




^ permalink raw reply	[flat|nested] 37+ messages in thread
* generic question
@ 2003-11-23 20:59 shoko
  2003-11-23 21:41 ` Marius Amado Alves
  0 siblings, 1 reply; 37+ messages in thread
From: shoko @ 2003-11-23 20:59 UTC (permalink / raw)


hi i have the following generic package:
--------------------------------
generic 
   type s is (<>); -- enum type of the abc of the automat 
   type s_ARR (integer range <>) of s;

package a is
   someting
end a;

------------------------------------
generic
  with package a1 is new  a(<>);  
package b is
          
   
      procedure foo(str:String;var_s:a1.s_ARR);

end b;
--------------------------------------------
i have a procedure
 procedure foo(str:String;var_s:a1.s_ARR) is
 begin
 end foo;
-----------------------------------------------
and my main program:

procdure main is
  type s is('o','p');
  type s_ARR is array(integer range <>) of s;
  package instant_a is new a(s,s_ARR);
  package instant_b is new b(instant_a); 
begin
  instant_b.foo("opoo",<>);

end main;     
----------------------------------------------
i want to send the instant of the generic package a to the function b

how do i do it right?



^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2006-11-29 15:57 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-19 18:03 generic question markww
2006-11-19 19:17 ` Ludovic Brenta
2006-11-19 19:23   ` Stefan Bellon
2006-11-19 20:16     ` markww
2006-11-19 22:07     ` Pascal Obry
2006-11-20 10:35       ` Alex R. Mosteo
2006-11-20 17:03         ` Pascal Obry
2006-11-20 18:10           ` Alex R. Mosteo
2006-11-20 21:16             ` markww
2006-11-20 21:40               ` Matthew Heaney
2006-11-20 21:50       ` Matthew Heaney
2006-11-21  7:04         ` Pascal Obry
2006-11-21  8:25           ` Alex R. Mosteo
2006-11-21 14:25             ` Matthew Heaney
2006-11-21 15:47               ` Matthew Heaney
2006-11-21 17:14                 ` Pascal Obry
2006-11-21 18:15                   ` Matthew Heaney
2006-11-21 18:28                     ` Dmitry A. Kazakov
2006-11-21 14:21           ` Matthew Heaney
2006-11-21 17:12             ` Pascal Obry
2006-11-21 17:25               ` Lutz Donnerhacke
2006-11-21 17:35                 ` Alex R. Mosteo
2006-11-21 18:18                 ` Matthew Heaney
2006-11-22 23:58                 ` Randy Brukardt
2006-11-23  8:32                   ` Dmitry A. Kazakov
2006-11-28 21:23                     ` Randy Brukardt
2006-11-29 15:57                       ` Matthew Heaney
2006-11-21 18:14               ` Matthew Heaney
2006-11-23  0:02                 ` Randy Brukardt
2006-11-21 18:17               ` Dmitry A. Kazakov
2006-11-21 18:32                 ` Matthew Heaney
2006-11-19 20:24 ` Jeffrey R. Carter
2006-11-19 20:33   ` markww
2006-11-20 17:31 ` Adam Beneschan
2006-11-21 16:22 ` Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
2003-11-23 20:59 shoko
2003-11-23 21:41 ` Marius Amado Alves

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