Michael Boccara (boccara++at++MIT.EDU)
Mon, 07 Sep 1998 18:04:21 -0700
Whenever you have to subclass a pfNode, you have to care about the type mecanism
inherent to Performer.
The node's type is checked at almost every database traversal, and thus you
can't mess with it...
Your subclass should look like that :
(pfSubDCS.h)
class pfSubDCS : public pfDCS
{
private:
static pfType *classType;
public:
static void init();
static pfType* getClassType() { return classType; }
virtual const char* getTypeName(void) const { return "mbGrabBall"; }
/* whatever you want */
};
(pfSubDCS.C)
// necessary initialisation of static data
pfType* pfSubDCS::classType = NULL;
void
pfSubDCS::init(void)
{
// once
if (classType == NULL) {
pfDCS::init();
classType =
new pfType(pfDCS::getClassType(), "pfSubDCS");
}
}
(main.C)
main()
{
pfInit();
...
// has to be called for type to be recognized later
pfSubDCS::init();
...
}
___________________________________________________________________
Michael Boccara Massachusetts Institute of Technology
Research Laboratory of Electronics
(617) 253 0005 Virtual Environment Technologies for Training
This archive was generated by hypermail 2.0b2 on Mon Sep 07 1998 - 15:03:41 PDT