Abstract and Concrete Classes
This section highlights some common points among the classes in the Essential Tools Module.
The Essential Tools Module provides implementation, not policy. Hence, it consists mostly of a large and rich set of concrete classes that are usable in isolation and independent of other classes for their implementation or semantics. They can be pulled out and used just one or two at a time. Concrete classes are the heart of the Essential Tools Module.
The Essential Tools Module also includes a rich set of abstract base classes, which define an interface for persistence, internationalization, and other issues, and a number of implementation classes that implement these interfaces.
Some Essential Tools Module classes are further categorized as collection classes, or collections, as explained in
“Collection Class Group”.
Collection classes generally follow the Smalltalk naming conventions and semantical model:
SortedCollection,
Dictionaries,
Bags,
Sets, and so on. They use similar interfaces, allowing them to be interchanged easily. The template-based collections will hold any kind of object; the Smalltalk-like collections require that all collected items inherit from
RWCollectable.
Choosing which collection classes to use in your programs is not a trivial task.
Appendix A can help you decide which class is the best for your purposes. The Classes | Class Hierarchy tab of the
../sourceproref:index.htmlSourcePro C++ API Reference Guide shows the class hierarchy of all the public Essential Tools Module classes. In addition to these public classes, the Essential Tools Module
contains other classes for its own internal use.
Concrete Classes
The concrete classes consist of:
Simple Classes
The Essential Tools Module provides a rich set of lightweight
simple classes. By lightweight, we mean classes with low-cost initializers and copy constructors. These classes include
RWDateTime for dates and times, with support for various time zones and locales),
RWCString (for single and multibyte strings), and
RWWString (for wide character strings). Most instantiations of these classes can be stored in four bytes or less, and have very simple copy constructors (usually just a bit copy) and no virtual functions. The
../sourceproref:index.htmlSourcePro C++ API Reference Guide provides additional information on these classes.
Template-based Collection Classes
Template-based collection classes, or templates, give you the advantages of speed and type-safe usage. When templates are used sparingly, their code size can be quite small. When templates are used with many different types, however, their code size can become large because each type effectively generates a whole new class. If you have the C++ Standard Library, you can use the Essential Tools Module template-based collections that are based on the C++ Standard Library. If you do not have the C++ Standard Library, you can use a subset of the templates, described in
“The C++ Standard Library Containers” and
“Iterators and the std() Gateway”.
Abstract Base Classes
The Essential Tools Module includes a set of abstract base classes and corresponding specializing classes that provides a framework for many issues. The list below identifies some of these issues and associates them with their respective abstract base classes. The description of each class in the ../sourceproref:index.htmlSourcePro C++ API Reference Guide indicates whether it is an abstract base class.
Table 1 – Abstract base classes and issues
Issue | Class | Where Discussed |
Locale | | |
Time zones | | |
Virtual streams | | |
Polymorphic persistence | | |
Virtual page heaps | | Reference Guide |
Model-View-Controller abstraction | | Reference Guide |