Libraries for C++

The employment of appropriate libraries may be crucial to the success of a software development project. Libraries show a great variety with respect to the features offered, the reliability of the code and the level and quality of documentation. In this section we will discuss the criteria by which to evaluate (C++) libraries. We restrict ourselves largely to a discussion of public domain libraries, but also a number of commercially available libraries will be mentioned. A trend that is worth mentioning is the publication of books including (source code) software, usually pertaining to a particular domain. For C/C++ books are available including software for graphics (e.g. Ammeraal, 1992),\index{Ammeraal (1992)} mathematics (e.g. Reverchon and Duchamp, 1993),\index{Reverchon and Duchamp (1993)} discrete event simulation (e.g. Watkins, 1993),\index{Watkins (1993)} neural networks (e.g. Blum, 1992),\index{Blum (1992)} data structures (e.g. Gorlen {\it et al.}, 1990), \index{Gorlen {\it et al.} (1990)} modeling (e.g. Henderson, 1993)\index{Henderson (1993)} and programming (e.g. Coad and Nicola, 1993).\index{Coad and Nicola (1993)} Obviously, the advantage of this format is the availability of (in principle) carefully written documentation. The number and quality of libraries becoming available for C++ is increasing rapidly. Prices for these libraries vary widely. The starting point for most users will be what price they are willing to pay and what platform and compiler they have at their disposal. Often, especially for IBM-compatible PCs, a compiler comes with a number of libraries. For example, the Borland C++ compiler includes a powerful graphics library that has become quite popular (measured by the number of books about graphics programming in Borland C++). An easily overlooked aspect of libraries is what requirements they impose with respect to additional hardware or software. However, with the development of standards (such as the multimedia standard for PCs) this is less likely to become a problem.

User specific criteria

evaluation

Domain

Features


slide: Libraries -- evaluation criteria

Naturally, an important criterion for choosing a library is the domain of application it covers. Possible domains include data structures, graphical programming, mathematical programming, database applications and also business and financial applications. Important features that must be paid attention to when selecting a particular library are the documentation (which preferably includes online help and a collection of tutorial examples), the support offered (for example browsing tools, the ease of installation and the compatibility with other libraries and environments). Also important is whether the library conforms to the standards being developed by ANSI and ISO, and more recently by the OMG. As for the use of C++ language features, the standard reference to which both ANSI and ISO adhere is  [ES90]. In the near future, moreover, libraries will probably be required to be CORBA-compliant. See section OMG. With respect to the documentation requirements, we may observe that many library vendors have been forced to include the source code to compensate for insufficient documentation. In addition, frequent changes to the source code are needed to permit effective derivation by inheritance. Only when conventions emerge that are commonly subscribed to will this no longer be necessary. For each of the domains mentioned in slide 11-lib-criteria, we may list a number of functional requirements that must be minimally satisfied.

Requirements

-- interaction
  • data structures -- string, list, stack, tree, bag, set, map, graph
  • mathematics -- matrix, complex, statistics, algebra
  • simulation -- resource, process, events, random, histogram

Requirements for GUI class libraries

-- events
  • control -- buttons, entry, listbox, menu, slider
  • dialogs -- message, file selector, online help
  • graphics -- point, line, box, rectangle, circle, bitmap
  • platform -- window manager, drag and drop
  • tools -- interface builder

slide: Libraries -- functionality requirements

For example, we may expect a library for data structures to support strings, lists, stacks, bags and sets, and preferably also maps (such as hashtables) and trees and graphs. Also, we may expect a mathematics library to support matrices, complex numbers, statistical functions and algebraic features. And we may expect a simulation library to support resources, processes, events, random number generation and histograms. Particular attention should be paid to how the various structures supported by a library may interact. For example, can we define a tree search for strings and can we manipulate matrices of complex numbers? Similar requirements may be stated for libraries supporting the development of graphical user interfaces. Minimally, such a library should contain control features (such as buttons, entry widgets, listboxes and menus), dialog features (such as messages, file selectors and facilities to create online help) and a collection of graphics items (including points, lines, boxes, rectangles, circles and bitmaps). See slide 11-requirements. Generally, GUI libraries are platform dependent. However, platform independent GUI libraries do exist, although they do not usually offer the full functionality supported by a particular platform (which may include drag and drop facilities and interaction with the window manager). Finally, some GUI libraries come with additional tools such as an interface builder, which provides a fast way for developing interface prototypes. In the next chapter, we will discuss the issues involved in developing a hypermedia framework, including the design of a user interface development library. In the following we will briefly discuss a number of the C++ libraries that are currently available. Most of the libraries mentioned are in the public domain with the exception of those that are explicitly indicated as commercial. For the public domain libraries we indicate where they may be obtained via anonymous ftp (for those having access to the Internet). For most libraries there will be other ftp sites as well from which the software may be retrieved. The quality and extent of the libraries varies considerably. Hence, the reader is urged to perform a preliminary evaluation before incorporating any of these libraries in an actual software project.

Structures

The general purpose libraries, offering data structures and utilities, show considerable variation in size and organization. See slide 11-lib-structures. No standard data structures library for C++ does yet exist. However, it is one of the goals of the ANSI committee to arrive at such a standard.

Structures

  • NIHCL -- Smalltalk-like utilities \c{\zline{alw.nih.gov:/pub/NIHCL} }
  • OATH -- type hierarchy \c{\zline{cs.utexas.edu:/pub/OATH}}
  • COOL -- structures \c{\zline{cs.utexas.edu:/pub/COOL}}
  • LEDA -- algorithms \c{\zline{iamsun.unibe.ch:C++}}
  • OSE -- templates \c{\zline{iamsun.unibe.ch:C++}}
  • Splash -- perl utilities \c{\zline{iamsun.unibe.ch:C++}}
  • Libg++ -- utilities \c{\zline{aeneas.mit.edu:/pub/gnu}}

Commercial

  • Classix -- container classes \c{\zline{BSO/Tasking}}
  • Tools.h++ \c{\zline{Rogue Wave}}
  • Booch C++ Components \c{\zline{(Booch and Vilot, 1990}}

slide: Libraries for (data) structures

One of the first and most well-known libraries with data structures and utilities is the National Institute of Health class library NIHCL. See  [GOP90]. NIHCL offers (apart from common data structures such as lists, strings and arbitrary length numbers) meta-level functionality in a Smalltalk-like fashion, which enables the user for example to ask for the class (type) of a particular object and for the methods supported by that class. The library is organized as a single inheritance hierarchy, with a type Object at the root. The NIHCL library was developed before templates were generally available, and may be regarded in general as somewhat cumbersome to use. The OATH library is organized as a forest. It offers an abstract definition of data structures such as lists, bags, sets and a collection of number types. A quite noteworthy characteristic of the OATH library is that a distinction is made between a type hierarchy underlying the type definition of the data structures and an implementation hierarchy containing the actual class implementations. A disadvantage of the OATH library is that it imposes a rather complicated protocol for usage and refinement. COOL stands for {\em Common Object Oriented Library}. It offers a very extensive collection of classes and a large number of data types. Similar to the NIHCL library and the OATH library, it stems from a pre-template era. Moreover, it requires the use of a pre-processor. The LEDA library also offers, in addition to a number of data structures, algorithms for combinatorial computing and computational geometry. It is free for research and education, but requires a license for commercial applications. A quite extensive library of general purpose classes, including facilities for memory management and operating system utilities, is offered by the OSE library. In contrast to the libraries previously discussed, OSE supports (standard C++) template classes. In addition, OSE provides a number of tools to facilitate maintenance and documentation, such as a tool to convert .h include files to manual pages. OSE is claimed by its developers to work for a wide spectrum of compilers and platforms. Unlike the other libraries, the Splash library is a fairly small library offering a few, rather powerful constructs such as strings (including pattern matching methods), lists (in the form of standard C++ template classes) and associative arrays. The Splash library has been developed to make perl-like string manipulation and list processing facilities available in C++. The Libg++ library (a library with data structures and utilities that comes with GNU C++) comes closest to a standard library for C++. However, it is currently only available for GNU C++. Commercially available, we have the Classix library (which offers a number of general purpose data structures and facilities for meta-level programming), the Rogue Wave Tools.h libraries (offering a variety of data structures). Further, the Booch C++ Components offer a variety of structures as originally developed for Ada. The library supports multi-tasking and a non-standard template facility.

Mathematics

Similar as for the general purpose data structure libraries, there is a variety of (mutually incompatible) mathematical libraries for C++. See slide 11-lib-mathematics.

Mathematics

  • Matrix -- general \c{\zline{ftp.cs.ucla}}
  • Vector -- 3D graphics \c{\zline{ftp.cs.unc.edu}}
  • Newmath -- experimental \c{\zline{iamsun.unibe.ch:C++}}
  • RW Vector -- Rogue Wave \c{\zline{iamsun.unibe.ch:C++}}
  • Armath -- general \c{\zline{(Reverchon and Ducamp, 1993)}}
  • Numerical Recipes -- reference \c{\zline{(Press {\it et al.}, 1992)}}

Commercial

  • Math.h, Matrix.h, Linpack.h \c{\zline{Rogue Wave}}

slide: Libraries for mathematics

General (medium-sized) matrix manipulation facilities are offered by the Matrix library. The Vector library, in contrast, is dedicated to 3 and 4 elements matrix and vector classes, suitable for 3D graphical work. The Newmath library is an experimental matrix and vector manipulation library which (as a special feature) also offers an interface to the functions provided by Numerical Recipes. A (to some extent) more standard approach is taken in the RW Vector library, which offers (as a public domain library) the facilities for matrix manipulation and linear algebra that are provided in the (commercial) Rogue Wave Math.h, Matrix.h and Linpack.h libraries (for PC platforms). Apart from portability, this has the advantage that one may obtain proper documentation with respect to the usage and functionality of the facilities offered. Another interesting collection of classes for mathematical programming is provided by the Armath library described in  [Rever93], which includes the software. As an important reference and code source for numerical programming in C we may mention  [Recipes]. As a remark, a disadvantage of all the libraries mentioned is that when they do offer template classes, they offer them as (non-standard) macro-defined templates. Again, standardization (of both the language and the compilers) is of utmost importance to arrive at well-established conventions for doing mathematics in C++.

Discrete event simulation

Despite the fact that object-oriented programming languages are historically related to discrete event simulation, additional functionality is needed to write simulation programs in C++.

Discrete event simulation

  • AweSim -- process-based \c{\zline{ftp.cs.colorado.edu:/pub/cs/distribs}}
  • Silo -- event-based \c{\zline{iamsun.unibe.ch:C++}}
  • Csim -- events and processes \c{\zline{(Watkins, 1993)}}
  • sim++ {\em -- a C++ extension of Csim} \c{\zline{ftp.cs.vu.nl:eliens}}

Commercial

  • Meijin++Pro \c{\zline{DOS}}

slide: Libraries for discrete event simulation

A process-based package for simulation is provided by AweSim, which includes some statistical features, queues and processes. It requires GNU C++ and may be regarded as an extension of Libg++, including features for discrete simulation. Also based on Libg++ is the Silo packages which provides a C++ version of the event-based approach described in  [MacD87], which was originally implemented in C. In  [Watkins93] an approach to discrete event simulation is described that encompasses both event-based and process-based simulation. Software, written in C, is included. It provides an excellent introduction to the problems of discrete event simulation and discusses a variety of applications. An C++ extension of the Csim software, including a number of examples, is available at {\tt ftp.cs.vu.nl:eliens}. As a commercial library for simulation, we may mention Meijin++Pro (which, however, only operates under DOS).

User interface development

The two most popular window environments nowadays are X-windows (which operates under Unix) and MS-windows (which provides a window environment on top of DOS). Although both environments provide a C interface (as a collection of low-level library functions), most application developers prefer a library that provides higher-level functionality and pre-defined widgets. The credo of the consortium supporting X-windows may be expressed as the wish to offer mechanism instead of policy. Two standards have been developed which do support policy (that is, conventions with respect to the graphical layout of user interfaces) as well, namely the Motif standard (that is adhered to by many X-window library vendors) and the Openlook standard.

User interface development

  • ET++ -- general \c{\zline{iamsun.unibe.ch:/C++}}
  • InterViews -- interaction \c{\zline{interviews.stanford.edu:/pub/3.1}}
  • Suit -- portable \c{\zline{uvacs.cs.virginia.edu:/pub/suit}}
  • Theseus++ -- hypermedia \c{\zline{ftp.igd.fhg.de}}
  • Hush {\em -- a C++ API for Tcl/Tk} \c{\zline{ftp.cs.vu.nl:eliens}}

Commercial

  • Xv++, StarView, Zinc Interface Library

slide: Libraries for GUI development

One of the earliest graphic user interface development libraries for C++ is ET++. See  [Weinand88]. Originally developed for SunView, ET++ is now also available for X-windows. It is part of a programming environment PE++, which includes program support tools such as browsers and editors. See slide 11-lib-GUI. Another important library for developing user interfaces (under X-windows) in C++ is the InterViews library. See  [LVC89]. Intended as a research vehicle, the InterViews library provides an important example of designing an object-oriented library. In particular, it supports object interaction mechanisms related to the MVC-paradigm discussed in section cooperation. It includes a library (Unidraw) for structured graphics and even provides a user interface builder. Experience in students' assignment, however, shows that the library is not very easy to use, which is partly due to the absence of proper documentation. A library for window programming in C, which is interesting primarily because it is available for both X-windows and MS-windows, is the SUIT library. The Theseus++ library provides a collection of classes for developing hypermedia systems. I cannot report any experience, but the approach seems promising. Lastly, I mention the hush library, which provides a C++ interface to the Tcl/Tk toolkit operating under X-windows. See  [Ousterhout91]. As we will discuss in the next chapter, the design of hush has been inspired by the InterViews library. However, it provides a considerably simplified class structure, yet offers the full functionality of the underlying Tcl/Tk toolkit. See section hush. Both the InterViews library and the Tcl/Tk toolkit (and as a consequence the hush library) comply (optionally) with the Motif standard. For the commercial libraries a distinction may be made between the libraries that claim to be platform-independent and the libraries associated with a particular platform or environment. An example of a platform-dependent library is Xv++, which provides an interface to XView. The platform-independent libraries (such as StarView and the Zinc Interface Library) provide an interface that is portable across X-windows and MS-windows environments. For example, StarView even supports OS/2, MS-Windows, OSF/Motif, OPENLOOK and the MacIntosh window system.

Distribution and persistence

In comparison with the libraries encountered in the previous domains, the C++ libraries available for distribution, communication and persistence are of a fairly experimental nature. See slide 11-lib-dis.

Distribution and persistence

  • SockStream -- sockets \c{\zline{ftp.cs.cornell.edu:/pub/sockets}}
  • RPC++ -- remote procedure call \c{ \zline{iamsun.unibe.ch:C++}}
  • ACE -- communication wrappers \c{\zline{ics.uci.edu:gnu}}
  • SOS -- object model \c{\zline{iamsun.unibe.ch:C++}}

Commercial

  • NetClasses -- Unix \c{\zline{PostModern Computing}}
  • POET -- object persistence

slide: Libraries for distribution and persistence

The SockStream library provides a collection of stream-like classes for communications via sockets and the select statement. The RPC++ library provides a C++ interface to the Sun remote procedure call package. A rather large collection of communication features is offered by the ACE library. Included in the ACE library are classes for event-based processing and inter-application communication. See  [Schmidt93]. Persistence is supported by the SOS library. SOS consists of an object description compiler and associated support classes. It is the result of a project aimed at developing the Obst multi-paradigm object database system. See section pde. A commercial package supporting communication and object transport over a network is NetClasses, from PostModern Computing technologies Inc. As a commercial library supporting object persistence in C++ we may mention POET.