Jim Helman (jimh++at++surreal)
Tue, 20 Jun 95 20:06:29 -0700
Yes. You can subclass from Performer classes to add additional
data members or functions. Overloading the existing methods is
also possible, but unless you are completely replacing all the
functionality of a base class method, you will often end up
invoking that base class method as part of yours since we are not
yet exposing all of the internal traversal and sorting control,
e.g. pfSequence::cull().
Subclassing also requires a type system that allows the creation
of new types and the identification of an object's class
membership. Like Inventor, Performer 2.0 has a pfType object and
an isOfType() method. These replace the old bitmask-based class
system of 1.X, e.g.
Performer 1.2's:
if (pfGetType(node)&PFCLASS_GROUP) ...
becomes
if (pfIsOfType(node, pfGetGroupClassType()))...
or in C++
if (node->isOfType(node, pfGroup::getClassType()))...
PORTING WARNING: much traversal code in 1.2 (e.g.
libpfutil/trav.c) used switch statements. With an extensible type
system, most of these exact type tests need to become IsOfType()
tests, since library code doesn't know what sort of subclassing a
user's application or database might have done. Some knowledge of
the class hierarchy is required, since membership in derived
classes should be tested before their ancestors.
rgds,
-jim helman
jimh++at++surreal.asd.sgi.com
415/390-1151
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:36 PDT