diff --git a/src/ifcparse/schema.cpp b/src/ifcparse/schema.cpp index 3e8462f584..d8ce885763 100644 --- a/src/ifcparse/schema.cpp +++ b/src/ifcparse/schema.cpp @@ -173,7 +173,7 @@ ifcopenshell::schema_definition::schema_definition(const std::string& name, cons ent->all_attributes(); } - register_schema(this); + register_schema(*this); } ifcopenshell::schema_definition::~schema_definition() { @@ -182,7 +182,7 @@ ifcopenshell::schema_definition::~schema_definition() { } } -void ifcopenshell::register_schema(schema_definition* schema) { +void ifcopenshell::register_schema(schema_definition& schema) { schema_registry_instance().bind(schema); } @@ -244,10 +244,10 @@ void ifcopenshell::schema_registry::bind(const std::string& schema_name, get_sch entry.module_ = module; } -void ifcopenshell::schema_registry::bind(schema_definition* schema) { +void ifcopenshell::schema_registry::bind(schema_definition& schema) { std::lock_guard lock(mutex_); - auto& entry = entries_[schema_key(schema->name())]; - entry.schema_ = schema; + auto& entry = entries_[schema_key(schema.name())]; + entry.schema_ = &schema; } const ifcopenshell::schema_definition* ifcopenshell::schema_registry::get(const std::string& schema_name) { diff --git a/src/ifcparse/schema.h b/src/ifcparse/schema.h index 0ce09181d2..6011042d6d 100644 --- a/src/ifcparse/schema.h +++ b/src/ifcparse/schema.h @@ -510,7 +510,7 @@ class IFC_PARSE_API schema_registry { typedef void register_schema_plugin_fn(schema_registry&, const ifcopenshell::plugin::module&); void bind(const std::string& schema_name, get_schema_fn get, clear_schema_fn clear, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module()); - void bind(schema_definition* schema); + void bind(schema_definition& schema); const schema_definition* get(const std::string& schema_name); std::vector names(); void clear(); @@ -548,7 +548,7 @@ IFC_PARSE_API const schema_definition* schema_by_name(const std::string& schema_ IFC_PARSE_API std::vector schema_names(); -IFC_PARSE_API void register_schema(schema_definition* schema); +IFC_PARSE_API void register_schema(schema_definition& schema); IFC_PARSE_API void clear_schemas(); } // namespace ifcopenshell