comp.lang.ada
 help / color / mirror / Atom feed
From: "Carroll, Andrew" <andrew.carroll@okstate.edu>
To: <comp.lang.ada@ada-france.org>
Subject: Design help
Date: Fri, 9 Mar 2007 16:43:06 -0600
Date: 2007-03-09T23:45:07+01:00	[thread overview]
Message-ID: <mailman.116.1173480208.18371.comp.lang.ada@ada-france.org> (raw)

I am trying to design (what I guess is) a database table adapter.  Yes,
it is a master's course assignment.  The current design is to use a file
and have one record per line.  My goal is to get each line to be
"serialized" so I can read the whole line in bytes and then take chunks
of it and "cast" those into objects.

On this list from a previous poster I found:

   type Byte is range 0..255;
   for Byte'Size use 8;
   package Byte_IO is new Sequential_IO(Byte);

Does that mean I could define the record like:

   type dbrecord is range 0..sum_of_sizes_of_attributes;
   for dbrecord'size use sum_of_sizes_of_attributes;
   package DBRecord_IO is new Sequential_IO(dbrecord);

My next big question....

If I had
   myrec: dbrecord;
   ...
   Dbrecord := <some data>...
   ...

   X := dbrecord(33..70);  --what type is x here?
   attribute := cast(X);  --how do I cast x to an 'class?


Am I making any sense?


Andrew Carroll
Software Services
405-744-4943
andrew.carroll@okstate.edu



             reply	other threads:[~2007-03-09 22:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-09 22:43 Carroll, Andrew [this message]
2007-03-09 23:07 ` Design help Simon Wright
2007-03-10  1:00 ` Jeffrey R. Carter
2007-03-10  4:40 ` Steve
2007-03-10 13:38 ` Ludovic Brenta
2007-03-17 20:34 ` Michael Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2007-03-13  0:50 Carroll, Andrew
2007-03-13  2:48 ` Randy Brukardt
2007-03-13  8:52 ` Stuart
2007-03-13  9:40 ` Dmitry A. Kazakov
2007-03-13 20:18   ` Simon Wright
2007-03-13 22:22   ` Randy Brukardt
2007-03-26 14:56 Carroll, Andrew
replies disabled

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