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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,28a24746aa07c732 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 09 Mar 2007 22:39:02 -0600 From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Design help Date: Fri, 9 Mar 2007 20:40:47 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-teUzsPZuTQOEjoM/3FvUeMfUnEIn/yIp7IGkuyg67+EZ5HrcnN0fWOBDAUDmxmf4Suw1XWw//OM8Ki2!qNGD1iHEIYA44dm6mzicQqctiDxvuRrpO4mNwnn5gLkgD2rxq+O2GusylFE/ZAKYSsVqmgZl4X4t!mkSFRVCEdEUFvN+POmf95AZxdwbKRQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news1.google.com comp.lang.ada:14446 Date: 2007-03-09T20:40:47-08:00 List-Id: >"Carroll, Andrew" wrote in message >news:mailman.116.1173480208.18371.comp.lang.ada@ada-france.org... >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); > This defines a scalar data type for bytes. Ok so far. >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); > This looks a bit odd. Here a scalar range is called "dbrecord" is defined that may contain the values in the range of 0 to sum_of_sizes_of_attributes. So, for example, if sum_of_sizes_of_attributes is 32, values of type dbrecord may be assigned values in the range of 0 to 32. The representation clause for dbrecord'size use sum_of size_attributes indicates that the storage size for those values is 32 bits... So values in the range of 0 to 32 are being stored in 32 bits... no problem with that, but I don't think it is what was intended. >My next big question.... > >If I had > myrec: dbrecord; > ... > Dbrecord := ... > ... > > 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? > Not really. I would suggest that you pick up a book on Ada. It is a language worth learning. Regards, Steve (The Duck) > >Andrew Carroll >Software Services >405-744-4943 >andrew.carroll@okstate.edu >