Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

A String Class Based on a Reference Counted Array

This source base implements a String container. Closely associated with the String class is a SubString class which defines sub-sections of Strings.

The String class is a reference counted object. Rather than copying data, reference counted classes increment a reference count when one object is assigned to another. For example, when a is assigned to b below, the reference count will be incremented. Both objects will share a common data object, which in this case contains the string "slithey toves".

String a = "slithey toves"; String b = a;

Reference counted objects implement copy-on-write semantics. A unique copy will be made of an object before it is modified it it shares data with other objects. For example, when a is changed by the statement below, b will remain unchanged (e.g., it will still contain "slithey toves").

a(8, 5) = "Boyd"; // a is now "slighey Boyd"

The String object is derived from an instance of the RCArray template (e.g., RCArray<char>).

The String object is complicated because it provides a number of functions that are specific to the String container. The DoubleVec class is simpler. DoubleVec demonstrates how a growable reference counted array can be derived from RCArray<double>.

Regression tests are included for the String class (StringTest.C), the SubString class (SubStrTest.C) and the DoubleVec class (DblVecTest.C). The DblVecTest.C regression tests serve as a test for the RCArray template.

Generating the Documentation

The source code documentation for this software is formatted for doxygen, which is available from Doxygen creates diagrams using the dot program, which is part of AT&T's Graphviz. Both Doxygen and Graphviz run on the major platforms (e.g., Linux, Windoz and Solaris).

Assuming that doxygen is installed on your system, along with dot you can regenerate this documentation with the command

doxygen doxygenTemplate

Copyright and Use

You may use this source code without limitation and without fee as long as you include:

This software was written and is copyrighted by Ian Kaplan, Bear Products International,, 2001, 2002, 2003.

This software is provided "as is", without any warrenty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International.

Please send any bug fixes or suggested source changes to:

Generated on Mon Sep 22 20:22:58 2003 by doxygen 1.3.3