TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-type: text/plain; charset="iso-8859-1"
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date: Tue, 16 Oct 2001 09:53:46 +1000
MIME-version: 1.0
Parts/Attachments: text/plain (35 lines)
> Just a quick question about Ada95.  Is there such a thing as a Collection
> Object, or an equivalent data structure that would allow me to do the
> following, for example.  Either included in Ada, or coded and available somewhere as a
> library.

Included in Ada? No. Just as the Java Classes for such are not part of the Java Language, nor C++'s STL part of C++.

Coded and available somewhere in a library? Yes. The difficulty is in finding exactly what type you want. Unlike Sun's Java site, there isn't a single source repository with all the standard templates in for Ada (Note to Self,.. wouldn't it be a good idea if there was...). See for just some of the many libraries of free Ada software.

It's made more difficult because of Ada's power to control things. Most collection objects in most languages don't provide any facilities for saying what the maximum size of the collection is, how space is to be managed, garbage collected etc. It's left entirely up to each implementation.

There are such "simple user-friendly" packages available for Ada too. Implementation of a simple stack, list etc is as trivial as "Hello World", any basic textbook will contain one. But there are many others, some of which are for polymorphic types, others with controlled space allocation, automatic space reclamation, reference counting etc. For a simple Generic way of doing things, try the GWU Generic_List by Feldman

Ehud Lamm's gives the whole code, specs and bodies for one such which might be of use to you if you don't want to use generics for some reason.

Of course there's also the famous Booch Components available at which has amongst other things:

Bounded, Dynamic and Unbounded Bags
Bounded, Dynamic and Unbounded Collections
Bounded, Dynamic and Unbounded Ordered Collections
Bounded, Dynamic and Unbounded Deques
Directed and Undirected Graphs
Single and Double Lists
Bounded, Dynamic and Unbounded Maps
Bounded, Dynamic and Unbounded Queues
Bounded, Dynamic and Unbounded Ordered Queues
Bounded, Dynamic and Unbounded Rings
Bounded, Dynamic and Unbounded Sets
Bounded, Dynamic and Unbounded Stacks
AVL Trees
Binary Trees
etc etc etc

10 minutes searching should find you a plethora of others. I think one of these should do :-)