Extended Booch Componentes

Please note that - with the next release - the Extended Booch Componentes become an part of the main Booch Components distribution.

The original booch components only work with definite types (type Item is private;). In object orientated programming one often like to work with class wide types (Object'Class). However class wide types are indefinite. The normal way around this problem is the use of access types. This is cumbersome and very C like. Ada can do better then that.

AdaCL features an extension kit for the Booch Components. Currently the extension kit supports specialised containers for tagged (type Item (<>) is abstract tagged private;) and indefinite (type Item (<>) is private;) types.

The containers for tagged types aren't really needed. An BC.Indefinite_Containers with Item => Object'Class will do the same. Thanks to Matthew Heaney for pointing that out to me. So you may consider the BC.Tagged_Containers obsolete.

Item_Storage

The BC.Indefinite_Containers need an additional parameter (Item_Storage : in out System.Storage_Pools.Root_Storage_Pool'Class;) to be instantiated. There is only that much which one can to with stack storage so if you want to store indefinite types will you need heap storage. But apart from supplying a suitable storage pool for the elements you don't need to worry about using the heap.

Of course, the dynamic and unbounded containers need storage pools of there own which may or may not be the same as the one for the elements.

Indefinite Iterators

The parameters for iterators also only allow definite types (type Item is private;). I can't see any reason for it. In order to better support object orientated programming I have supplied iterators which take Indefinite types as parameter (type Param_Type (<>) is private.

How it was done

Because component libraries contain a lot of repetitive work only a very few Packages of the extensions kit are actually programmed manually. The majority was created by an automated process from the original booch components. AdaSL(approve sites) used a similar technique employing gnatprep.

Of course with gnatprep one need to declare and use macros. And this involves changes to the original code.

Besides, the largest part of AdaCL is its text file search and replace library, perfectly suitable for this kind of work. Actually it works so well that no manual intervention is needed.

if you like to convert the booch components yourself you can do so by calling:

 export BC_Dir=Path to original BC.
 make bc_clean bc

You will need a working version of sarBC first which itself need the booch components to be compiled. That's why the converted files are included in the distribution as well as in the cvs archives.


Ada programming, © 2005,2006 the Authors, Content is available under GNU Free Documentation License.