mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Clean-up parsed simple types #7185
This commit is contained in:
@@ -725,6 +725,7 @@ void IfcParse::impl::in_memory_file_storage::load(unsigned entity_instance_name,
|
||||
// the 2nd pass.
|
||||
load(entity_instance_name, entity, ps, attribute_index == -1 ? (int)attribute_index_within_data : attribute_index);
|
||||
auto* simple_type_instance = (schema ? schema : file->schema())->instantiate(decl, ps.construct(entity_instance_name, *references_to_resolve, decl, boost::none, attribute_index == -1 ? (int)attribute_index_within_data : attribute_index));
|
||||
read_simple_type_instances.push_back(simple_type_instance);
|
||||
//@todo decide addEntity(((IfcUtil::IfcBaseClass*)*entity));
|
||||
context.push(simple_type_instance);
|
||||
simple_type_instance->file_ = file;
|
||||
|
||||
@@ -189,6 +189,8 @@ namespace IfcParse {
|
||||
|
||||
namespace impl {
|
||||
struct IFC_PARSE_API in_memory_file_storage {
|
||||
std::vector<IfcUtil::IfcBaseClass*> read_simple_type_instances;
|
||||
|
||||
IfcParse::IfcSpfLexer* tokens;
|
||||
// IfcParse::IfcSpfStream* stream;
|
||||
|
||||
@@ -212,6 +214,11 @@ namespace IfcParse {
|
||||
typedef entity_instance_by_name_t::iterator iterator;
|
||||
|
||||
in_memory_file_storage(IfcParse::IfcFile* f = nullptr) : tokens(nullptr), file(f), schema(nullptr) {}
|
||||
~in_memory_file_storage() {
|
||||
for (auto* inst : read_simple_type_instances) {
|
||||
delete inst;
|
||||
}
|
||||
}
|
||||
in_memory_file_storage(const in_memory_file_storage&) = delete;
|
||||
in_memory_file_storage(const in_memory_file_storage&&) = delete;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user