Static Public Member Functions | |
static Type | as (PyObject *obj, bool throw_error) |
Definition at line 3693 of file SyFi_wrap.cc.
static Type swig::traits_as< Type, pointer_category >::as | ( | PyObject * | obj, | |
bool | throw_error | |||
) | [inline, static] |
Definition at line 3694 of file SyFi_wrap.cc.
References swig::asptr(), run_all::res, SWIG_Error, SWIG_ERROR, SWIG_IsNewObj, SWIG_IsOK, and SWIG_TypeError.
03694 { 03695 Type *v = 0; 03696 int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR); 03697 if (SWIG_IsOK(res) && v) { 03698 if (SWIG_IsNewObj(res)) { 03699 Type r(*v); 03700 delete v; 03701 return r; 03702 } else { 03703 return *v; 03704 } 03705 } else { 03706 // Uninitialized return value, no Type() constructor required. 03707 static Type *v_def = (Type*) malloc(sizeof(Type)); 03708 if (!PyErr_Occurred()) { 03709 SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); 03710 } 03711 if (throw_error) throw std::invalid_argument("bad type"); 03712 memset(v_def,0,sizeof(Type)); 03713 return *v_def; 03714 } 03715 }