[BACK]Return to switch.i CVS log [TXT][DIR] Up to [Development] / performer / src / pyper

File: [Development] / performer / src / pyper / switch.i (download)

Revision 1.1, Mon May 21 21:40:00 2001 UTC (16 years, 5 months ago) by flynnt
Branch: MAIN
CVS Tags: HEAD

Doing some cleanup and adding the pfgtk example and the python wrapper for
Performer (pyper).

// This file contains the public interface from the Performer
// header file pf/pfSwitch.h
// This Performer header file is (c) Silicon Graphics, Inc.
// Binding specific code is (c) SARA.

%{
#include <Performer/pf/pfSwitch.h>
%}




/* pfSwitchVal() */

#define PFSWITCH_ON		-1
#define PFSWITCH_OFF		-2


class pfSwitch : public pfGroup
{
  public:

    %addmethods
    {
      char *__str__()
      {
        static char temp[256];
        const char *name = self->getName();
        float val = self->getVal();
        if (name)
          sprintf(temp, "pfSwitch named '%s' with val %f", name, val);
        else
          sprintf(temp, "unnamed pfSwitch with val %f", val);
        return temp;
      }
      void toggle(void) { self->setVal((self->getVal()==PFSWITCH_ON)?PFSWITCH_OFF:PFSWITCH_ON); }
      // ARGH! UGLY HACK TO FIX BROKEN POLYMOPHISM IN SWIG! - Bram
      pfNode *GetAsNode(void) { return self; }
    }

    int setVal(float val);
    float getVal() const;
    int setValFlux(pfFlux *_valFlux);
    pfFlux* getValFlux() const;

    pfSwitch();
    virtual ~pfSwitch();
};