Pass around non-static logger instances and programmatic access to messages in-memory

This commit is contained in:
Thomas Krijnen
2026-06-10 18:30:54 +02:00
parent a751fb956d
commit a7738eeb64
132 changed files with 1029 additions and 884 deletions
+1
View File
@@ -169,6 +169,7 @@
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), declaration_type_to_swig(t), 0); }
PyObject* pythonize(const log_message& t) { return SWIG_NewPointerObj(SWIG_as_voidptr(&t), SWIGTYPE_p_log_message, 0); }
// @nb ownership
PyObject* pythonize(const IfcGeom::ConversionResultShape* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcGeom__ConversionResultShape, SWIG_POINTER_OWN); }
// PyObject* pythonize(const IfcGeom::ConversionResultShape* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcGeom__ConversionResultShape, 0); }
+18
View File
@@ -406,3 +406,21 @@ CREATE_OPTIONAL_TYPEMAP_IN(std::string, string, str)
CREATE_SET_TYPEMAP_IN(int)
CREATE_SET_TYPEMAP_IN(std::string)
// for the logger codes
%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING) SWIGTYPE &code_prefix {
$1 = PyUnicode_Check($input);
}
%typemap(in) SWIGTYPE &code_prefix (char tmp[4]) {
Py_ssize_t len = 0;
const char *s = PyUnicode_AsUTF8AndSize($input, &len);
if (!s || len != 3) {
SWIG_exception_fail(SWIG_ValueError, "Expected Python str of length 3");
}
memcpy(tmp, s, 3);
tmp[3] = '\0';
$1 = &tmp;
}
+1
View File
@@ -108,6 +108,7 @@ CREATE_VECTOR_TYPEMAP_OUT(IfcParse::inverse_attribute const *)
CREATE_VECTOR_TYPEMAP_OUT(IfcParse::entity const *)
CREATE_VECTOR_TYPEMAP_OUT(IfcParse::declaration const *)
CREATE_VECTOR_TYPEMAP_OUT(IfcGeom::ConversionResultShape *)
CREATE_VECTOR_TYPEMAP_OUT(log_message)
%typemap(out) ifcopenshell::geometry::Settings::value_variant_t {
pythonizing_visitor vis;