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=-2.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MAILING_LIST_MULTI,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,306c0e782f999b0e X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Booch components Date: 2000/10/18 Message-ID: #1/1 X-Deja-AN: 683900139 Content-Transfer-Encoding: 8bit References: To: comp.lang.ada@ada.eu.org Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@enst.fr X-Trace: menuisier.enst.fr 972068535 2150 137.194.161.2 (20 Oct 2000 19:02:15 GMT) Organization: ENST, France List-Id: comp.lang.ada mail<->news gateway X-Mailman-Version: 2.0beta5 X-BeenThere: comp.lang.ada@ada.eu.org Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 20 Oct 2000 19:02:15 GMT Newsgroups: comp.lang.ada Date: 2000-10-20T19:02:15+00:00 "Alexey V. Litvinov" writes: > When I tried to use Booch components in my program, > I encountered some trouble with next code (It's abstraction of > database table as file of simular entities.=20 Could you possibly set your newsreader not to generate these '=20' characters? I think it may have something to do with "quoted printable" > With little diffirent mechanism of deleting/appending of > records from Dbase-like. Because I'll have little couple=20 > of deleted records with my application and I don't wish=20 > make packing of table, I decide use unbounded queue for list=20 > of deleted records and use values from it when I need to=20 > append new records). Unless you really need the polymorphic aspects of Lists, I *strongly* recomment that you use Collections. > with Ada.Direct_IO; > > generic > type RecDataType is private; > FileName : String; > > package DB_Table is > > type RecCountType is private; > type RecPosvCountType is private; > --. > --. > --. -- routines to read/write/append/etc... > --. > > private > > package Table_IO is new Ada.Direct_IO(RecDataType); > > type RecCountType is new Table_IO.Count; > type RecPosvCountType is new Table_IO.Positive_Count; > =20 > type DEItem is record > Pos: Table_IO.Positive_Count; > end record; > > package DE_IO is new Ada.Direct_IO(DEItem); > > TableFile : Table_IO.File_Type; > DEFile : DE_IO.File_Type; > > end DB_Table;=20 > > with Ada.Direct_IO; > with BC; > with BC.Containers; > with BC.Containers.Queues; > with BC.Containers.Queues.Unbounded; > with BC.Support.Unmanaged_Storage; > > package body DB_Table is > =20 > package Unmanaged_Storage renames BC.Support.Unmanaged_Storage; > Storage: Unmanaged_Storage.Pool; > > package Containers is new BC.Containers(Item =3D> DEItem); The problem is that the BCs are based on tagged types; and you can only derive new tagged types in a package *spec*. Move all these instantiations into the spec and you should be OK. > package Queues is new Containers.Queues; > package UBQueue is new Queues.Unbounded > (Unmanaged_Storage.Pool, = > Storage); > > --. > --. > --. -- routines to read/write/append/etc... > --. > > end DB_Table; > > After compliling with GNAT 3.13p: > gcc -c -gnatf db_table.adb > db_table.adb:13:04: instantiation error at bc-containers.ads:132 > db_table.adb:13:04: parent type must not be outside generic body > gnatmake: "db_table.adb" compilation error Yes, this is a strange error message, I'll make a problem report to ACT. > But this trouble arising only if my package is generic, when I made=20 > just simular simple package compling was saccessful. > > Good Old Question: knew somebody what I'm doing wrong,=20 > or why things are going wrong? > > PS: at bc.containers.ads:132 we have > private > > -- We need access to Items; but we must make sure that no actual > -- allocations occur using this type. > > type Item_Ptr is access all Item; > for Item_Ptr'Storage_Size use 0; > > > type Container is abstract new Ada.Finalization.Controlled with null = > record; > ? I don't see what you think is wrong here? I would have posted this reply in c.l.a, but for the moment my newsfeed is under revision :-) and I can only read.