comp.lang.ada
 help / color / mirror / Atom feed
From: "Alexey V. Litvinov" <lial@khrts.khv.ru>
To: <comp.lang.ada@ada.eu.org>
Subject: Booch components
Date: Wed, 18 Oct 2000 12:11:38 +1100
Date: 2000-10-18T01:13:26+00:00	[thread overview]
Message-ID: <MABBJLHONCNCBAPGDDMMKEFPCAAA.lial@khrts.khv.ru> (raw)

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. 
With little diffirent mechanism of deleting/appending of
records from Dbase-like. Because I'll have little couple 
of deleted records with my application and I don't wish 
make packing of table, I decide use unbounded queue for list 
of deleted records and use values from it when I need to 
append new records).

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;
 
   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; 

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
 
   package Unmanaged_Storage renames BC.Support.Unmanaged_Storage;
   Storage: Unmanaged_Storage.Pool;

   package Containers is new BC.Containers(Item => DEItem);
   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

But this trouble arising only if my package is generic, when I made 
just simular simple package compling was saccessful.

Good Old Question: knew somebody what I'm doing wrong, 
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>

  -- Private primitive operations.
  -- These should ideally be abstract; instead, we provide implementations,
  -- but they raise Should_Have_Been_Overridden.






             reply	other threads:[~2000-10-18  1:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-18  1:11 Alexey V. Litvinov [this message]
2000-10-18  0:00 ` Booch components Simon Wright
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