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:
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.
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.
The sequence is implemented using segmented arrays, allowing for very large sequences.
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.
An iterator is provided allowing the inspection of the stored `key-value' pairs. The implementation uses a sorted Sequence.
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.
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'.
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.
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.