From: Simon Wright <simon@pogner.demon.co.uk>
To: comp.lang.ada@ada.eu.org
Subject: Re: Booch components
Date: 2000/10/18
Date: 2000-10-20T19:02:15+00:00 [thread overview]
Message-ID: <x7vg0lthm8b.fsf@smaug.moho> (raw)
In-Reply-To: MABBJLHONCNCBAPGDDMMKEFPCAAA.lial@khrts.khv.ru
"Alexey V. Litvinov" <lial@khrts.khv.ru> 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;
>
> <this>
> type Container is abstract new Ada.Finalization.Controlled with null =
> record;
> </this>
? 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.
next prev parent reply other threads:[~2000-10-18 0:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-18 1:11 Booch components Alexey V. Litvinov
2000-10-18 0:00 ` Simon Wright [this message]
2000-10-23 3:20 ` Alexey V. Litvinov
-- strict thread matches above, loose matches on Subject: below --
2002-03-14 8:38 Booch Components Martin Dowie
2001-12-01 5:04 Mt. Nyiragongo
2001-12-01 8:02 ` Simon Wright
2001-12-02 3:21 ` Mt. Nyiragongo
1995-03-08 15:39 Matthew Heaney
1994-12-01 15:20 John Porter
1994-12-01 19:29 ` David Weller
1992-10-13 12:37 dog.ee.lbl.gov!news!vela!wsu-cs!usenet.ins.cwru.edu!agate!linus!linus.mit
1992-10-10 2:41 think.com!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!ehsn4.cen.uiuc.ed
1992-10-09 15:47 Ralph Curtis
1989-08-01 16:04 Marcus Moehrmann
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox