Fixes for mapping declaration subtypes to SWIG

This commit is contained in:
Thomas Krijnen
2019-04-03 13:55:29 +02:00
parent 6e42f82e1a
commit 45c3c27fb5
2 changed files with 14 additions and 10 deletions
+13 -1
View File
@@ -106,6 +106,18 @@
// Conversion functions to convert STL vectors into Python objects
%{
swig_type_info* declaration_type_to_swig(const IfcParse::declaration* t) {
if (t->as_entity()) {
return SWIGTYPE_p_IfcParse__entity;
} else if (t->as_type_declaration()) {
return SWIGTYPE_p_IfcParse__type_declaration;
} else if (t->as_select_type()) {
return SWIGTYPE_p_IfcParse__select_type;
} else if (t->as_enumeration_type()) {
return SWIGTYPE_p_IfcParse__enumeration_type;
}
}
PyObject* pythonize(const int& t) { return PyInt_FromLong(t); }
PyObject* pythonize(const unsigned int& t) { return PyInt_FromLong(t); }
PyObject* pythonize(const bool& t) { return PyBool_FromLong(t); }
@@ -115,7 +127,7 @@
PyObject* pythonize(const IfcParse::attribute* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcParse__attribute, 0); }
PyObject* pythonize(const IfcParse::inverse_attribute* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcParse__inverse_attribute, 0); }
PyObject* pythonize(const IfcParse::entity* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcParse__entity, 0); }
PyObject* pythonize(const IfcParse::declaration* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcParse__declaration, 0); }
PyObject* pythonize(const IfcParse::declaration* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), declaration_type_to_swig(t), 0); }
// NB: This cannot be temporary as a Python object is constructed from a pointer to the address of this object
PyObject* pythonize(const IfcGeom::Material& t) { return SWIG_NewPointerObj(SWIG_as_voidptr(&t), SWIGTYPE_p_IfcGeom__Material, 0); }
+1 -9
View File
@@ -11,15 +11,7 @@
}
%typemap(out) IfcParse::declaration* {
if ($1->as_entity()) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1->as_entity()), SWIGTYPE_p_IfcParse__entity, 0);
} else if ($1->as_type_declaration()) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1->as_type_declaration()), SWIGTYPE_p_IfcParse__type_declaration, 0);
} else if ($1->as_select_type()) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1->as_select_type()), SWIGTYPE_p_IfcParse__select_type, 0);
} else if ($1->as_enumeration_type()) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1->as_enumeration_type()), SWIGTYPE_p_IfcParse__enumeration_type, 0);
}
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1), declaration_type_to_swig($1), 0);
}
%typemap(out) IfcParse::parameter_type* {