SurfaceOfExtrusionPy.cpp

Go to the documentation of this file.
00001 
00002 // This file is generated by src/Tools/generateTemaplates/templateClassPyExport.py out of the .XML file
00003 // Every change you make here get lost at the next full rebuild!
00004 // This File is normaly build as an include in SurfaceOfExtrusionPyImp.cpp! Its not intended to be in a project!
00005 
00006 #include <boost/filesystem/path.hpp>
00007 #include <boost/filesystem/operations.hpp>
00008 #include <boost/filesystem/exception.hpp>
00009 #include <Base/PyObjectBase.h>
00010 #include <Base/Console.h>
00011 #include <Base/Exception.h>
00012 #include <CXX/Objects.hxx>
00013 
00014 #define new DEBUG_CLIENTBLOCK
00015 
00016 using Base::streq;
00017 using namespace Part;
00018 
00020 PyTypeObject SurfaceOfExtrusionPy::Type = {
00021     PyObject_HEAD_INIT(&PyType_Type)
00022     0,                                                /*ob_size*/
00023     "Part.GeomSurfaceOfExtrusion",     /*tp_name*/
00024     sizeof(SurfaceOfExtrusionPy),                       /*tp_basicsize*/
00025     0,                                                /*tp_itemsize*/
00026     /* methods */
00027     PyDestructor,                                     /*tp_dealloc*/
00028     0,                                                /*tp_print*/
00029     __getattr,                                        /*tp_getattr*/
00030     __setattr,                                        /*tp_setattr*/
00031     0,                                                /*tp_compare*/
00032     __repr,                                           /*tp_repr*/
00033     0,                                                /*tp_as_number*/
00034     0,                                                /*tp_as_sequence*/
00035     0,                                                /*tp_as_mapping*/
00036     0,                                                /*tp_hash*/
00037     0,                                                /*tp_call */
00038     0,                                                /*tp_str  */
00039     0,                                                /*tp_getattro*/
00040     0,                                                /*tp_setattro*/
00041     /* --- Functions to access object as input/output buffer ---------*/
00042     0,                                                /* tp_as_buffer */
00043     /* --- Flags to define presence of optional/expanded features */
00044     Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_CLASS,        /*tp_flags */
00045     "Describes a surface of linear extrusion",           /*tp_doc */
00046     0,                                                /*tp_traverse */
00047     0,                                                /*tp_clear */
00048     0,                                                /*tp_richcompare */
00049     0,                                                /*tp_weaklistoffset */
00050     0,                                                /*tp_iter */
00051     0,                                                /*tp_iternext */
00052     Part::SurfaceOfExtrusionPy::Methods,                     /*tp_methods */
00053     0,                                                /*tp_members */
00054     Part::SurfaceOfExtrusionPy::GetterSetter,                     /*tp_getset */
00055     &Part::GeometrySurfacePy::Type,                        /*tp_base */
00056     0,                                                /*tp_dict */
00057     0,                                                /*tp_descr_get */
00058     0,                                                /*tp_descr_set */
00059     0,                                                /*tp_dictoffset */
00060     __PyInit,                                         /*tp_init */
00061     0,                                                /*tp_alloc */
00062     Part::SurfaceOfExtrusionPy::PyMake,/*tp_new */
00063     0,                                                /*tp_free   Low-level free-memory routine */
00064     0,                                                /*tp_is_gc  For PyObject_IS_GC */
00065     0,                                                /*tp_bases */
00066     0,                                                /*tp_mro    method resolution order */
00067     0,                                                /*tp_cache */
00068     0,                                                /*tp_subclasses */
00069     0,                                                /*tp_weaklist */
00070     0                                                 /*tp_del */
00071 };
00072 
00074 PyMethodDef SurfaceOfExtrusionPy::Methods[] = {
00075     {NULL, NULL, 0, NULL}               /* Sentinel */
00076 };
00077 
00078 
00079 
00081 PyGetSetDef SurfaceOfExtrusionPy::GetterSetter[] = {
00082     {"Direction",
00083         (getter) staticCallback_getDirection,
00084         (setter) staticCallback_setDirection, 
00085         "\n                                     Sets or gets the direction of revolution.\n                             ",
00086         NULL
00087     },
00088     {"BasisCurve",
00089         (getter) staticCallback_getBasisCurve,
00090         (setter) staticCallback_setBasisCurve, 
00091         "\n                                     Sets or gets the basic curve.\n                         ",
00092         NULL
00093     },
00094     {NULL, NULL, NULL, NULL, NULL}              /* Sentinel */
00095 };
00096 
00097 // Direction() callback and implementer
00098 // PyObject*  SurfaceOfExtrusionPy::Direction(PyObject *args){};
00099 // has to be implemented in SurfaceOfExtrusionPyImp.cpp
00100 PyObject * SurfaceOfExtrusionPy::staticCallback_getDirection (PyObject *self, void * /*closure*/)
00101 {
00102     if (!((PyObjectBase*) self)->isValid()){
00103         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00104         return NULL;
00105     }
00106 
00107     try {
00108         return Py::new_reference_to(((SurfaceOfExtrusionPy*)self)->getDirection());
00109     } catch (const Py::Exception&) {
00110         // The exception text is already set
00111         return NULL;
00112     } catch (...) {
00113         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'Direction' of object 'GeomSurfaceOfExtrusion'");
00114         return NULL;
00115     }
00116 }
00117 
00118 int SurfaceOfExtrusionPy::staticCallback_setDirection (PyObject *self, PyObject *value, void * /*closure*/)
00119 {    
00120     if (!((PyObjectBase*) self)->isValid()){
00121         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00122         return -1;
00123     }
00124     if (((PyObjectBase*) self)->isConst()){
00125         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00126         return -1;
00127     }
00128 
00129     try {
00130         ((SurfaceOfExtrusionPy*)self)->setDirection(Py::Object(value,false));
00131         return 0;
00132     } catch (const Py::Exception&) {
00133         // The exception text is already set
00134         return -1;
00135     } catch (...) {
00136         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'Direction' of object 'GeomSurfaceOfExtrusion'");
00137         return -1;
00138     }
00139 }
00140 
00141 // BasisCurve() callback and implementer
00142 // PyObject*  SurfaceOfExtrusionPy::BasisCurve(PyObject *args){};
00143 // has to be implemented in SurfaceOfExtrusionPyImp.cpp
00144 PyObject * SurfaceOfExtrusionPy::staticCallback_getBasisCurve (PyObject *self, void * /*closure*/)
00145 {
00146     if (!((PyObjectBase*) self)->isValid()){
00147         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00148         return NULL;
00149     }
00150 
00151     try {
00152         return Py::new_reference_to(((SurfaceOfExtrusionPy*)self)->getBasisCurve());
00153     } catch (const Py::Exception&) {
00154         // The exception text is already set
00155         return NULL;
00156     } catch (...) {
00157         PyErr_SetString(PyExc_Exception, "Unknown exception while reading attribute 'BasisCurve' of object 'GeomSurfaceOfExtrusion'");
00158         return NULL;
00159     }
00160 }
00161 
00162 int SurfaceOfExtrusionPy::staticCallback_setBasisCurve (PyObject *self, PyObject *value, void * /*closure*/)
00163 {    
00164     if (!((PyObjectBase*) self)->isValid()){
00165         PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!");
00166         return -1;
00167     }
00168     if (((PyObjectBase*) self)->isConst()){
00169         PyErr_SetString(PyExc_ReferenceError, "This object is immutable, you can not set any attribute or call a method");
00170         return -1;
00171     }
00172 
00173     try {
00174         ((SurfaceOfExtrusionPy*)self)->setBasisCurve(Py::Object(value,false));
00175         return 0;
00176     } catch (const Py::Exception&) {
00177         // The exception text is already set
00178         return -1;
00179     } catch (...) {
00180         PyErr_SetString(PyExc_Exception, "Unknown exception while writing attribute 'BasisCurve' of object 'GeomSurfaceOfExtrusion'");
00181         return -1;
00182     }
00183 }
00184 
00185 
00186 
00187 //--------------------------------------------------------------------------
00188 // Parents structure
00189 //--------------------------------------------------------------------------
00190 PyParentObject SurfaceOfExtrusionPy::Parents[] = { PARENTSPartSurfaceOfExtrusionPy };
00191 
00192 //--------------------------------------------------------------------------
00193 // Constructor
00194 //--------------------------------------------------------------------------
00195 SurfaceOfExtrusionPy::SurfaceOfExtrusionPy(GeomSurfaceOfExtrusion *pcObject, PyTypeObject *T)
00196     : GeometrySurfacePy(reinterpret_cast<GeometrySurfacePy::PointerType>(pcObject), T)
00197 {
00198 }
00199 
00200 
00201 //--------------------------------------------------------------------------
00202 // destructor
00203 //--------------------------------------------------------------------------
00204 SurfaceOfExtrusionPy::~SurfaceOfExtrusionPy()                                // Everything handled in parent
00205 {
00206 }
00207 
00208 //--------------------------------------------------------------------------
00209 // SurfaceOfExtrusionPy representation
00210 //--------------------------------------------------------------------------
00211 PyObject *SurfaceOfExtrusionPy::_repr(void)
00212 {
00213     return Py_BuildValue("s", representation().c_str());
00214 }
00215 
00216 //--------------------------------------------------------------------------
00217 // SurfaceOfExtrusionPy Attributes
00218 //--------------------------------------------------------------------------
00219 PyObject *SurfaceOfExtrusionPy::_getattr(char *attr)                            // __getattr__ function: note only need to handle new state
00220 {
00221     try {
00222         // getter method for special Attributes (e.g. dynamic ones)
00223         PyObject *r = getCustomAttributes(attr);
00224         if(r) return r;
00225     }
00226 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00227     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00228     {
00229         std::string str;
00230         str += "FreeCAD exception thrown (";
00231         str += e.what();
00232         str += ")";
00233         e.ReportException();
00234         PyErr_SetString(PyExc_Exception,str.c_str());
00235         return NULL;
00236     }
00237     catch(const std::exception& e) // catch other c++ exceptions
00238     {
00239         std::string str;
00240         str += "FC++ exception thrown (";
00241         str += e.what();
00242         str += ")";
00243         Base::Console().Error(str.c_str());
00244         PyErr_SetString(PyExc_Exception,str.c_str());
00245         return NULL;
00246     }
00247     catch(const Py::Exception&)
00248     {
00249         // The exception text is already set
00250         return NULL;
00251     }
00252     catch(...)  // catch the rest!
00253     {
00254         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00255         return NULL;
00256     }
00257 #else  // DONT_CATCH_CXX_EXCEPTIONS  
00258     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00259     {
00260         std::string str;
00261         str += "FreeCAD exception thrown (";
00262         str += e.what();
00263         str += ")";
00264         e.ReportException();
00265         PyErr_SetString(PyExc_Exception,str.c_str());
00266         return NULL;
00267     }
00268     catch(const Py::Exception&)
00269     {
00270         // The exception text is already set
00271         return NULL;
00272     }
00273 #endif  // DONT_CATCH_CXX_EXCEPTIONS
00274 
00275     PyObject *rvalue = Py_FindMethod(Methods, this, attr);
00276     if (rvalue == NULL)
00277     {
00278         PyErr_Clear();
00279         return GeometrySurfacePy::_getattr(attr);
00280     }
00281     else
00282     {
00283         return rvalue;
00284     }
00285 }
00286 
00287 int SurfaceOfExtrusionPy::_setattr(char *attr, PyObject *value)         // __setattr__ function: note only need to handle new state
00288 {
00289     try {
00290         // setter for  special Attributes (e.g. dynamic ones)
00291         int r = setCustomAttributes(attr, value);
00292         if(r==1) return 0;
00293     }
00294 #ifndef DONT_CATCH_CXX_EXCEPTIONS 
00295     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00296     {
00297         std::string str;
00298         str += "FreeCAD exception thrown (";
00299         str += e.what();
00300         str += ")";
00301         e.ReportException();
00302         PyErr_SetString(PyExc_Exception,str.c_str());
00303         return -1;
00304     }
00305     catch(const std::exception& e) // catch other c++ exceptions
00306     {
00307         std::string str;
00308         str += "FC++ exception thrown (";
00309         str += e.what();
00310         str += ")";
00311         Base::Console().Error(str.c_str());
00312         PyErr_SetString(PyExc_Exception,str.c_str());
00313         return -1;
00314     }
00315     catch(const Py::Exception&)
00316     {
00317         // The exception text is already set
00318         return -1;
00319     }
00320     catch(...)  // catch the rest!
00321     {
00322         PyErr_SetString(PyExc_Exception,"Unknown C++ exception");
00323         return -1;
00324     }
00325 #else  // DONT_CATCH_CXX_EXCEPTIONS  
00326     catch(const Base::Exception& e) // catch the FreeCAD exceptions
00327     {
00328         std::string str;
00329         str += "FreeCAD exception thrown (";
00330         str += e.what();
00331         str += ")";
00332         e.ReportException();
00333         PyErr_SetString(PyExc_Exception,str.c_str());
00334         return -1;
00335     }
00336     catch(const Py::Exception&)
00337     {
00338         // The exception text is already set
00339         return -1;
00340     }
00341 #endif  // DONT_CATCH_CXX_EXCEPTIONS
00342 
00343     return GeometrySurfacePy::_setattr(attr, value);
00344 }
00345 
00346 GeomSurfaceOfExtrusion *SurfaceOfExtrusionPy::getGeomSurfaceOfExtrusionPtr(void) const
00347 {
00348     return static_cast<GeomSurfaceOfExtrusion *>(_pcTwinPointer);
00349 }
00350 
00351 #if 0
00352 /* From here on come the methods you have to implement, but NOT in this module. Implement in SurfaceOfExtrusionPyImp.cpp! This prototypes 
00353  * are just for convenience when you add a new method.
00354  */
00355 
00356 PyObject *SurfaceOfExtrusionPy::PyMake(struct _typeobject *, PyObject *, PyObject *)  // Python wrapper
00357 {
00358     // create a new instance of SurfaceOfExtrusionPy and the Twin object 
00359     return new SurfaceOfExtrusionPy(new GeomSurfaceOfExtrusion);
00360 }
00361 
00362 // constructor method
00363 int SurfaceOfExtrusionPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
00364 {
00365     return 0;
00366 }
00367 
00368 // returns a string which represents the object e.g. when printed in python
00369 std::string SurfaceOfExtrusionPy::representation(void) const
00370 {
00371     return std::string("<GeomSurfaceOfExtrusion object>");
00372 }
00373 
00374 
00375 
00376 Py::Object SurfaceOfExtrusionPy::getDirection(void) const
00377 {
00378     //return Py::Object();
00379     throw Py::AttributeError("Not yet implemented");
00380 }
00381 
00382 void  SurfaceOfExtrusionPy::setDirection(Py::Object arg)
00383 {
00384     throw Py::AttributeError("Not yet implemented");
00385 }
00386 
00387 Py::Object SurfaceOfExtrusionPy::getBasisCurve(void) const
00388 {
00389     //return Py::Object();
00390     throw Py::AttributeError("Not yet implemented");
00391 }
00392 
00393 void  SurfaceOfExtrusionPy::setBasisCurve(Py::Object arg)
00394 {
00395     throw Py::AttributeError("Not yet implemented");
00396 }
00397 
00398 PyObject *SurfaceOfExtrusionPy::getCustomAttributes(const char* attr) const
00399 {
00400     return 0;
00401 }
00402 
00403 int SurfaceOfExtrusionPy::setCustomAttributes(const char* attr, PyObject *obj)
00404 {
00405     return 0; 
00406 }
00407 #endif
00408 
00409 
00410 

Generated on Wed Nov 23 19:00:41 2011 for FreeCAD by  doxygen 1.6.1