comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Kennedy <q9522772@mail.connect.usq.edu.au>
Subject: How I declare a 'mod' type within a record?
Date: 1997/07/30
Date: 1997-07-30T00:00:00+00:00	[thread overview]
Message-ID: <33DF3FD2.20D2@mail.connect.usq.edu.au> (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




             reply	other threads:[~1997-07-30  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-30  0:00 Matthew Kennedy [this message]
1997-07-30  0:00 ` How I declare a 'mod' type within a record? Matthew Heaney
1997-07-31  0:00 ` Robert Dewar
1997-08-05  0:00 ` Mars Gralia
1997-08-05  0:00   ` John M. Mills
replies disabled

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