next up previous contents
Next: Packages and Other Up: Class Libraries Previous: VMP (2.2)

YACL - Yet Another Class Library (1.1)

  YACL is a general-purpose class library, provided in source form. A book will be published by Addison-Wesley in the summer of 1995 entitled `Developing Portable C++ Applications using YACL'.

YACl consists of three three main sets of classes:

Base Classes
consisting of primitive data types and container classes.
I/O Classes
for information storage and retrieval.
GUI Classes
using a version of the Model-View-Controller paradigm.

The first two sets of classes are currently available under MS Windows, OS/2, and Unix. The GUI is currently fully supported under MS Windows, and X11/Motif. OS/2 PM is partially supported.

This text will concentrate on the first two sets - but note that full, indexed documentation was not available at the time of writing.

The inheritance hierarchy is tree-like, most types being derived from the class CL_Object. This is used to provide (run-time) type identification, some persistency, and a `notification' (messaging) scheme.

Primitive types
include string, date, time-of-day, byte array and byte string.

The String class can be constructed with char arrays, byte arrays, and numbers as parameters. The string class is indexable, and also supports Substrings, a specialisation of the String class. The String class supports insertion, various decompositions, concatenation, and many comparison, conversion and `status' functions.

The ByteArray is a class used for managing (comparing, accessing, modifying) an area of memory not held by the class. The ByteString is derived from the byte array, and differs in that it contains the modifiable area of memory.

Parameterised Container Classes

Sequence (in lieu of lists)
The sequence has elements that can be accessed and modified by the subscript operator. The container supports add, insert and remove operations that provide for automatic growth and shrinkage as necessary. A sort function is provided, as well as both linear and binary searches. Both object references, and objects themselves can be held by the Sequence. Its base type must have a Compare function, as well as a copy constructor, default constructor, and an assignment operator.

The sequence is implemented using segmented arrays, allowing for very large sequences.

maintains a set of objects, including duplicates. It allows addition and insertion of objects, membership tests, and iteration over the contents, using a SetIterator class. The iterator provides the functions Reset(), More(), and Next(), so that the following is possible:
CL_StringSetIterator iter (my_set);
CL_String s;
for (iter.Reset(); iter.More(); ) {
    s = iter.Next();
   // Process the string s here....
The Set is implemented using a small sorted Sequence.
encapsulates the notion of a set of integers represented by a bit vector. It can store sets of integers in a given range 0.. max, where max is specified on construction.
maintains a `key' to `value' mapping. Keys must be unique, but otherwise any combination of types can be `mapped' provided that the key type has a Compare() method.

An iterator is provided allowing the inspection of the stored `key-value' pairs. The implementation uses a sorted Sequence.

maintains parent-child relationships among objects drawn from a LabelType class. The Tree class itself is a template class based on the LabelType parameter. The Tree supports querying, the addition or removal of nodes and subtrees, and `new root' and subtree extraction functions. A `post order walk' function traverses the tree, and a more generalised traverse function, performing actions at each node is supplied.

Note that Sequences, Sets, and Maps can be very large - up to almost 64 million entries. When storing pointers (object references), the collections are not responsible for their deletion.

Utility Classes
A `string splitter' and `tree walker' are provided.

The StringSplitter class is essentially a simple string parser, that allows a string to be viewed as being made from a series of fields. The set of field separators can be varied while the string is being inspected. Reset(), Next(), Scan and Remaining() methods provide an `iterator-like' ability to step over the fields.

Two `tree walker' classes are provided - Pre- and PostOrderWalkers. They are `tree iterators', and support Reset(), Next() operations and More() a boolean status check.

Memory Leaks
A memory leak checker class support functionality for checking for leaks and memory corruption errors.

File I/O
A `slotted' file class manages files with fixed length records, and a `byte string store' file class manager files with dynamically variable length records.

The SlottedFile class manages an array of fixed length records and provides fast random access to each record. Records are allocated unique handles, and the representation of the file guarantees that every method of the class (Add, Retrieve, Modify, Delete etc.) takes at most two read operations and three write operations. Files with up to 768 million records can be maintained. Additionally, the client program can define a header area for other data.

The ByteStringStore class has a similar interface to the SlottedFile class, but manages ByteStrings of variable length. No assertions are made on the number of I/O operations required. The implementation breaks each string into chunks, and writes these to the file. The chunks and file records are managed using linked lists - one per string to track the chunks allocated for each string, and another to manage the `string lists'.

Object I/O - Persistence
Due to the tree-like nature of the inheritance, and class type identification mechanism, persistence be handled essentially by carefully written read/write stream functions. The stored binary form of object data is platform dependent, and most of the supplied classes are persistable.

Both in-memory and on-disk trees are supported, both sharing the same B-Tree algorithm code. They can be used with the above file I/O functions for trees with variable length keys

Inter-object Communication
a `notification' mechanism supports messaging between class instances - this is used extensively by the GUI classes.

Objects derived from CL_Object can register their interest in another object. A notify() method messages all dependents. Typically this would be used to notify dependents of a change of state.


A set of classes including parameterised container classes, basic utility classes, support for object I/O, file I/O and very large sequences and maps. A set of GUI classes is also provided. The supported platforms are MS Windows, X11/Motif and OS/2 PM, although support for the latter in not complete.
g++ v2.6.0 (or greater) is required on Unix platforms. Cfront v3.0 could not compile the `sequence' class because of the use of automatic aggregates.
A full tutorial and reference manual is not yet available - parts of a book to be published in 1995 have been made available[22]. The main reference section currently available appears to have been automatically generated from the header files. Whether the library structure has been `fixed' is also not known.

Currently, there are no provisions for a `pooled' memory scheme, or `lazy' deletion of allocated segments in the Sequence based containers.

The library installation is immature - there are few notes about experiences obtained during installation on many UNIX flavours. Currently only g++ has been used on Linux and SunOS, sheltering the library from potential problems when used with cfront based or other commercial compilers.

The library[22], and although copyrighted, is freely distributable and modifiable, provided a disclaimer remains intact.
Version 1.1 was release in Frebruary 1995.
M.A. Srhidar

next up previous contents
Next: Packages and Other Up: Class Libraries Previous: VMP (2.2)

Paul Kent
Thu Mar 30 16:14:46 METDST 1995