Add IfcParse::clear_schemas() and individual Ifc___::clear_schema() to clear any resource allocated by registered schemas

Add missing virtual destructors in IfcSchema.h
This commit is contained in:
Adrien SCHVALBERG
2022-04-27 16:20:35 +02:00
committed by Thomas Krijnen
parent 93fd3f97e3
commit e677355438
20 changed files with 169 additions and 27 deletions
@@ -283,10 +283,22 @@ __attribute__((optnone))
self.statements.extend(
(
"const schema_definition& %s::get_schema() {" % schema_name_title,
"static std::unique_ptr<schema_definition> schema;",
"",
" static const schema_definition* s = %(schema_name)s_populate_schema();" % locals(),
" return *s;",
"void %s::clear_schema() {" % schema_name_title,
" schema.reset();",
"}",
"",
)
)
self.statements.extend(
(
"const schema_definition& %s::get_schema() {" % schema_name_title,
" if (!schema) {",
" schema.reset(%(schema_name)s_populate_schema());" % locals(),
" }",
" return *schema;",
"}",
"",
"",
@@ -38,6 +38,8 @@ struct %(schema_name)s {
IFC_PARSE_API static const IfcParse::schema_definition& get_schema();
IFC_PARSE_API static void clear_schema();
static const char* const Identifier;
// Forward definitions