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
+14
View File
@@ -55,6 +55,8 @@ namespace IfcParse {
class IFC_PARSE_API parameter_type {
public:
virtual ~parameter_type() {}
virtual const named_type* as_named_type() const { return static_cast<named_type*>(0); }
virtual const simple_type* as_simple_type() const { return static_cast<simple_type*>(0); }
virtual const aggregation_type* as_aggregation_type() const { return static_cast<aggregation_type*>(0); }
@@ -107,6 +109,8 @@ namespace IfcParse {
, type_of_element_(type_of_element)
{}
virtual ~aggregation_type() { delete type_of_element_; }
aggregate_type type_of_aggregation() const { return type_of_aggregation_; }
int bound1() const { return bound1_; }
int bound2() const { return bound2_; }
@@ -160,6 +164,8 @@ namespace IfcParse {
: declaration(name, index_in_schema)
, declared_type_(declared_type) {}
virtual ~type_declaration() { delete declared_type_; }
const parameter_type* declared_type() const { return declared_type_; }
virtual const type_declaration* as_type_declaration() const { return this; }
@@ -203,6 +209,8 @@ namespace IfcParse {
, type_of_attribute_(type_of_attribute)
, optional_(optional) {}
~attribute() { delete type_of_attribute_; }
const std::string& name() const { return name_; }
const parameter_type* type_of_attribute() const { return type_of_attribute_; }
bool optional() const { return optional_; }
@@ -277,6 +285,8 @@ namespace IfcParse {
, supertype_(supertype)
{}
virtual ~entity();
bool is(const std::string& name) const {
if (name == name_) return true;
else if (supertype_) return supertype_->is(name);
@@ -387,6 +397,8 @@ namespace IfcParse {
class IFC_PARSE_API instance_factory {
public:
virtual ~instance_factory() {}
virtual IfcUtil::IfcBaseClass* operator()(IfcEntityInstanceData* data) const = 0;
};
@@ -453,6 +465,8 @@ namespace IfcParse {
IFC_PARSE_API std::vector<std::string> schema_names();
IFC_PARSE_API void register_schema(schema_definition*);
IFC_PARSE_API void clear_schemas();
}
#endif