Subclassing pfObject

New Message Reply Date view Thread view Subject view Author view

Angel-Ventura Mendo Gomez (ventura++at++labri.u-bordeaux.fr)
Tue, 11 May 1999 10:50:13 +0200


Hi performers :

        I try to make a class GeoSetEditor:

class GeoSetEditor: public pfObject
{
 public:
  GeoSetEditor(void);
  GeoSetEditor(const GeoSetEditor&);
  virtual ~GeoSetEditor(void);

  void init(void);

  virtual void draw(void);
  //
  // Handlers
  //
  static void motionNotifyEventHandler(const pfCoord &cord,int
buttonMask,void *userData);
  static void buttonPressEventHandler(const pfCoord &cord,int
button,void *userData);
  static void buttonReleaseEventHandler(const pfCoord &cord,int
button,void *userData);
protected:
  void makeGeoSet(void *arena);

private:
  static pfType *classType;
   
  void *arena;

  pfVec3 *coords;
  pfVec4 *colors;

  pfGeoSet *gset;
};

And the problem is that for multiprocessing this class must be at the
shared arena , I think that the right
way to do this is to make pfObject the parent class of GeoSetEditor.

The constructor looks like :

pfType *GeoSetEditor::classType = NULL;

void
GeoSetEditor::init(void)
{
  fprintf(stderr,"+++ GeoSetEditor::init(void)\n");
  if (classType == NULL){
    pfObject::init();
    classType =
      new pfType(pfObject::getClassType(), "GeoSetEditor");
  }
  arena=pfGetSharedArena(); // I would Get the current Shared Arena for
"this" : new(arena) GeoSetEditor
                             // -------------- ^
                             // | |
                             // ------------------------------------
  makeGeoSet(arena);

  fprintf(stderr,"--- GeoSetEditor::init(void)\n");
}

GeoSetEditor::GeoSetEditor(void *arena):
  arena(arena)
{
  fprintf(stderr,"+++ GeoSetEditor::GeoSetEditor(void *arena):\n");
  init();
  setType(classType);
  fprintf(stderr,"--- GeoSetEditor::GeoSetEditor(void *arena):\n");
   
}

The questions :

        1) That's right ? the class is allocated on the shared arena ?
        2) When I create the GeoSetEditor, the pfGeoSet must be already created
at the shared arena.
           At the init() function I get the default Shared Arena but I would
like to put the pfGeoSet
           in the same Arena that the GeoSetClass.

                Thanks

-- 
	ventura++at++labri.u-bordeaux.fr
	http://dept-info.labri.u-bordeaux.fr/~ventura
	telephone 05.56.84.69.20

Quod natura non dat Salmantica non praestat.


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue May 11 1999 - 01:51:19 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.