00001 #ifndef _EMBEDDEDCLASS_H 00002 #define _EMBEDDEDCLASS_H 00003 00004 class EmbeddedClass : public PyObjectPlus { 00005 00006 Py_Header; // always start with Py_Header 00007 00008 protected: // additional state added by this subclass 00009 00010 00011 public: 00012 EmbeddedClass(char *name, 00013 PyTypeObject *T = &Type); // C++ constructor 00014 00015 static PyObject *PyMake(PyObject *, PyObject *); // Python constructor 00016 // (called by "new", see below) 00017 ~EmbeddedClass(); // C++ destructor 00018 00019 PyObject *_getattr(char *attr); // __getattr__ function 00020 int _setattr(char *attr, PyObject *value); // __setattr__ function 00021 00022 void PrintHello(void); 00023 PyObject* PyPrintHello(PyObject* args); 00024 static PyObject* sPyPrintHello(PyObject* self, PyObject *args, PyObject *kwds) 00025 { 00026 return ((EmbeddedClass*)self)->PyPrintHello(args); 00027 }; 00028 00029 00030 }; 00031 00032 #endif // _EMBEDDEDCLASS_H