comp.lang.ada
 help / color / mirror / Atom feed
* How I declare a 'mod' type within a record?
@ 1997-07-30  0:00 Matthew Kennedy
  1997-07-30  0:00 ` Matthew Heaney
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matthew Kennedy @ 1997-07-30  0:00 UTC (permalink / raw)



Hello all,

I'm trying to implement a time-series type to aid in defference equation
simulations. I would like to use a 'mod' type which would be an elegant
way of cycling around the buffer (which is just an array).

Here is my code example, if you could examine it, I would be very
grateful :)  The compiler (GNAT) has fits when it sees the anonymous mod
type declared within the record making use of 'Size' - which is the
record parameter.

Note, I can't declare 'mod Size' as a sepereate type outside
'time_series' because 'Size' must be part of 'time_series'.

Also, I can see how this could be made into a generic package but what I
need is multiple time-series of different sizes.

with Text_IO; use  Text_IO;
procedure Aging is

   type Number is new Float;
   type Buffer is array(Integer range <>) of Number;
   type Time_Series(Size : Integer) is
      record
         History : Buffer(0..Size-1);
         Head : mod Size;
      end record;

   X : Time_Series(3);
begin
   ...
end Aging;


Thank you,
Matthew

-- 
Matthew Kennedy
Student of Electronics Engineering
University of Southern Queensland, Australia
  "When will you realise your already there?" 
      - Marilyn Manson




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

end of thread, other threads:[~1997-08-05  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-30  0:00 How I declare a 'mod' type within a record? Matthew Kennedy
1997-07-30  0:00 ` Matthew Heaney
1997-07-31  0:00 ` Robert Dewar
1997-08-05  0:00 ` Mars Gralia
1997-08-05  0:00   ` John M. Mills

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