1-68 SOMobjects Base Toolkit: Programmer’s Reference Manual
SOMClass Class
Description
SOMClass is the root class for all SOM metaclasses. That is, all SOM metaclasses must be
subclasses of SOMClass or some other class derived from it. It defines the essential
behavior common to all SOM classes. In particular, it provides a suite of methods for
initializing class objects, generic methods for manufacturing instances of those classes, and
methods that dynamically obtain or update information about a class and its methods at run
time.
Just as all SOM classes are expected to have SOMObject (or a class derived from
SOMObject) as their base class, all SOM classes are expected to have SOMClass or a
class derived from SOMClass as their metaclass. Metaclasses define “class” methods
(sometimes called “factory” methods or “constructors”) that manufacture objects from any
class object that is defined as an instance of the metaclass.
To define your own class methods, define your own metaclass by subclassing SOMClass or
one of its subclasses. Three methods that SOMClass inherits and overrides from
SOMObject are typically overridden by any metaclass that introduces instance
data—somInit, somUninit, and somDumpSelfInt. The new methods introduced in
SOMClass that are frequently overridden are somNew, somRenew, and somClassReady.
(See the descriptions of these methods for further information.)
Other reasons for creating a new metaclass include tracking object instances, automatic
garbage collection, interfacing to a persistent object store, or providing/managing
information that is global to a set of object instances.
File Stem
somcls
Base
SOMObject
Metaclass
SOMClass (SOMClass is the only class with itself as metaclass.)
Ancestor Classes
SOMObject
Types
typedef sequence <SOMClass> SOMClassSequence;
struct somOffsetInfo {
SOMClass cls;
long offset
};
typedef sequence <somOffsetInfo> SOMOffsets;
Kommentare zu diesen Handbüchern