schema entity initialize() method, optional argument forwarding in file::create, populate_derived in InstanceData

This commit is contained in:
Thomas Krijnen
2026-01-15 19:24:55 +01:00
parent c089c11cd6
commit 4ec643d4e1
32 changed files with 38750 additions and 63173 deletions
+5 -11
View File
@@ -17,11 +17,11 @@ extern declaration* HEADER_SECTION_SCHEMA_types[5];
// Function implementations for schema_name
const IfcParse::type_declaration& Header_section_schema::schema_name::Class() { return *((IfcParse::type_declaration*)HEADER_SECTION_SCHEMA_types[3]); }
Header_section_schema::schema_name::operator std::string() const { return get_attribute_value(0); }
void Header_section_schema::schema_name::initialize(std::string v) { set_attribute_value(0, (v)); }
// Function implementations for time_stamp_text
const IfcParse::type_declaration& Header_section_schema::time_stamp_text::Class() { return *((IfcParse::type_declaration*)HEADER_SECTION_SCHEMA_types[4]); }
Header_section_schema::time_stamp_text::operator std::string() const { return get_attribute_value(0); }
void Header_section_schema::time_stamp_text::initialize(std::string v) { set_attribute_value(0, (v)); }
// Function implementations for file_description
@@ -31,10 +31,8 @@ std::string Header_section_schema::file_description::implementation_level() cons
void Header_section_schema::file_description::setimplementation_level(const std::string& v) { set_attribute_value(1, v);if constexpr (false)unset_attribute_value(1); }
// const IfcParse::entity& Header_section_schema::file_description::declaration() const { return *((IfcParse::entity*)HEADER_SECTION_SCHEMA_types[0]); }
const IfcParse::entity& Header_section_schema::file_description::Class() { return *((IfcParse::entity*)HEADER_SECTION_SCHEMA_types[0]); }
// Header_section_schema::file_description::file_description(const std::weak_ptr<InstanceData>& e) : express::Entity(e) { }
// Header_section_schema::file_description::file_description(std::vector< std::string > /*[1:?]*/ v1_description, std::string v2_implementation_level) : express::Entity(const std::weak_ptr<InstanceData>&(in_memory_attribute_storage(2))) { set_attribute_value(0, (v1_description));set_attribute_value(1, (v2_implementation_level));; populate_derived(); }
void Header_section_schema::file_description::initialize(std::vector< std::string > /*[1:?]*/ v1_description, std::string v2_implementation_level) { set_attribute_value(0, (v1_description));set_attribute_value(1, (v2_implementation_level)); }
// Function implementations for file_name
std::string Header_section_schema::file_name::name() const { std::string v = get_attribute_value(0); return v; }
@@ -53,18 +51,14 @@ std::string Header_section_schema::file_name::authorization() const { std::stri
void Header_section_schema::file_name::setauthorization(const std::string& v) { set_attribute_value(6, v);if constexpr (false)unset_attribute_value(6); }
// const IfcParse::entity& Header_section_schema::file_name::declaration() const { return *((IfcParse::entity*)HEADER_SECTION_SCHEMA_types[1]); }
const IfcParse::entity& Header_section_schema::file_name::Class() { return *((IfcParse::entity*)HEADER_SECTION_SCHEMA_types[1]); }
// Header_section_schema::file_name::file_name(const std::weak_ptr<InstanceData>& e) : express::Entity(e) { }
// Header_section_schema::file_name::file_name(std::string v1_name, std::string v2_time_stamp, std::vector< std::string > /*[1:?]*/ v3_author, std::vector< std::string > /*[1:?]*/ v4_organization, std::string v5_preprocessor_version, std::string v6_originating_system, std::string v7_authorization) : express::Entity(const std::weak_ptr<InstanceData>&(in_memory_attribute_storage(7))) { set_attribute_value(0, (v1_name));set_attribute_value(1, (v2_time_stamp));set_attribute_value(2, (v3_author));set_attribute_value(3, (v4_organization));set_attribute_value(4, (v5_preprocessor_version));set_attribute_value(5, (v6_originating_system));set_attribute_value(6, (v7_authorization));; populate_derived(); }
void Header_section_schema::file_name::initialize(std::string v1_name, std::string v2_time_stamp, std::vector< std::string > /*[1:?]*/ v3_author, std::vector< std::string > /*[1:?]*/ v4_organization, std::string v5_preprocessor_version, std::string v6_originating_system, std::string v7_authorization) { set_attribute_value(0, (v1_name));set_attribute_value(1, (v2_time_stamp));set_attribute_value(2, (v3_author));set_attribute_value(3, (v4_organization));set_attribute_value(4, (v5_preprocessor_version));set_attribute_value(5, (v6_originating_system));set_attribute_value(6, (v7_authorization)); }
// Function implementations for file_schema
std::vector< std::string > /*[1:?]*/ Header_section_schema::file_schema::schema_identifiers() const { std::vector< std::string > /*[1:?]*/ v = get_attribute_value(0); return v; }
void Header_section_schema::file_schema::setschema_identifiers(const std::vector< std::string > /*[1:?]*/& v) { set_attribute_value(0, v);if constexpr (false)unset_attribute_value(0); }
// const IfcParse::entity& Header_section_schema::file_schema::declaration() const { return *((IfcParse::entity*)HEADER_SECTION_SCHEMA_types[2]); }
const IfcParse::entity& Header_section_schema::file_schema::Class() { return *((IfcParse::entity*)HEADER_SECTION_SCHEMA_types[2]); }
// Header_section_schema::file_schema::file_schema(const std::weak_ptr<InstanceData>& e) : express::Entity(e) { }
// Header_section_schema::file_schema::file_schema(std::vector< std::string > /*[1:?]*/ v1_schema_identifiers) : express::Entity(const std::weak_ptr<InstanceData>&(in_memory_attribute_storage(1))) { set_attribute_value(0, (v1_schema_identifiers));; populate_derived(); }
void Header_section_schema::file_schema::initialize(std::vector< std::string > /*[1:?]*/ v1_schema_identifiers) { set_attribute_value(0, (v1_schema_identifiers)); }
+8 -10
View File
@@ -35,9 +35,8 @@ public:
schema_name() {}
explicit schema_name (const std::weak_ptr<InstanceData>& data) : express::DeclaredType(data) {}
// virtual const IfcParse::type_declaration& declaration() const;
static const IfcParse::type_declaration& Class();
// schema_name (std::string v);
void initialize(std::string v);
operator std::string() const;
};
@@ -46,9 +45,8 @@ public:
time_stamp_text() {}
explicit time_stamp_text (const std::weak_ptr<InstanceData>& data) : express::DeclaredType(data) {}
// virtual const IfcParse::type_declaration& declaration() const;
static const IfcParse::type_declaration& Class();
// time_stamp_text (std::string v);
void initialize(std::string v);
operator std::string() const;
};
@@ -63,9 +61,9 @@ public:
void setdescription(const std::vector< std::string > /*[1:?]*/& v);
std::string implementation_level() const;
void setimplementation_level(const std::string& v);
// virtual const IfcParse::entity& declaration() const;
static const IfcParse::entity& Class();
// file_description (std::vector< std::string > /*[1:?]*/ v1_description, std::string v2_implementation_level);
void initialize(std::vector< std::string > /*[1:?]*/ v1_description, std::string v2_implementation_level);
};
class IFC_PARSE_API file_name : public express::Entity {
@@ -87,9 +85,9 @@ public:
void setoriginating_system(const std::string& v);
std::string authorization() const;
void setauthorization(const std::string& v);
// virtual const IfcParse::entity& declaration() const;
static const IfcParse::entity& Class();
// file_name (std::string v1_name, std::string v2_time_stamp, std::vector< std::string > /*[1:?]*/ v3_author, std::vector< std::string > /*[1:?]*/ v4_organization, std::string v5_preprocessor_version, std::string v6_originating_system, std::string v7_authorization);
void initialize(std::string v1_name, std::string v2_time_stamp, std::vector< std::string > /*[1:?]*/ v3_author, std::vector< std::string > /*[1:?]*/ v4_organization, std::string v5_preprocessor_version, std::string v6_originating_system, std::string v7_authorization);
};
class IFC_PARSE_API file_schema : public express::Entity {
@@ -99,9 +97,9 @@ public:
std::vector< std::string > /*[1:?]*/ schema_identifiers() const;
void setschema_identifiers(const std::vector< std::string > /*[1:?]*/& v);
// virtual const IfcParse::entity& declaration() const;
static const IfcParse::entity& Class();
// file_schema (std::vector< std::string > /*[1:?]*/ v1_schema_identifiers);
void initialize(std::vector< std::string > /*[1:?]*/ v1_schema_identifiers);
};
};
+765 -2071
View File
File diff suppressed because it is too large Load Diff
+1751 -2032
View File
File diff suppressed because it is too large Load Diff
+898 -2450
View File
File diff suppressed because it is too large Load Diff
+2096 -2433
View File
File diff suppressed because it is too large Load Diff
+923 -2525
View File
File diff suppressed because it is too large Load Diff
+2152 -2492
View File
File diff suppressed because it is too large Load Diff
+938 -2570
View File
File diff suppressed because it is too large Load Diff
+2196 -2543
View File
File diff suppressed because it is too large Load Diff
+994 -2738
View File
File diff suppressed because it is too large Load Diff
+2370 -2748
View File
File diff suppressed because it is too large Load Diff
+1000 -2752
View File
File diff suppressed because it is too large Load Diff
+2370 -2745
View File
File diff suppressed because it is too large Load Diff
+1000 -2752
View File
File diff suppressed because it is too large Load Diff
+2370 -2745
View File
File diff suppressed because it is too large Load Diff
+1001 -2759
View File
File diff suppressed because it is too large Load Diff
+2372 -2744
View File
File diff suppressed because it is too large Load Diff
+1007 -2777
View File
File diff suppressed because it is too large Load Diff
+2390 -2765
View File
File diff suppressed because it is too large Load Diff
+999 -2753
View File
File diff suppressed because it is too large Load Diff
+2376 -2752
View File
File diff suppressed because it is too large Load Diff
+998 -2750
View File
File diff suppressed because it is too large Load Diff
+2374 -2750
View File
File diff suppressed because it is too large Load Diff
+995 -2739
View File
File diff suppressed because it is too large Load Diff
+2361 -2735
View File
File diff suppressed because it is too large Load Diff
+11 -1
View File
@@ -410,8 +410,18 @@ public:
void build_inverses_(const express::Base&);
// @nb this does not support id assignment
template <typename T, typename... Ts>
T create(Ts&&... args) {
T t = create(&T::Class()).template as<T>();
if constexpr (sizeof...(Ts) > 0) {
t.initialize(std::forward<Ts>(args)...);
}
return t;
}
template <typename T>
T create(int id=-1) {
T create(int id = -1) {
return create(&T::Class(), id).template as<T>();
}
+8 -7
View File
@@ -122,13 +122,14 @@ void IfcUtil::unescape_xml(std::string& str) {
boost::replace_all(str, "&gt;", ">");
}
void express::Entity::populate_derived() {
for (auto it = declaration().as_entity()->derived().begin(); it != declaration().as_entity()->derived().end(); ++it) {
if (*it) {
set_attribute_value(
std::distance(declaration().as_entity()->derived().begin(), it),
Derived{}
);
void InstanceData::populate_derived_() {
if (auto* ent = declaration_->as_entity()) {
for (auto it = ent->derived().begin(); it != ent->derived().end(); ++it) {
if (*it) {
set_attribute_value(
std::distance(ent->derived().begin(), it),
Derived{});
}
}
}
}
+8 -2
View File
@@ -420,6 +420,8 @@ class IFC_PARSE_API InstanceData {
template <typename T>
T* get_storage_of_type() const;
void populate_derived_();
public:
// Since rocks_db_attribute_storage has no members this is not a variant<in_memory, rocks> but in_memory*, where nullptr means a rocks_db_attribute_storage is constructed on the fly given the context from instance data.
in_memory_attribute_storage* storage_;
@@ -442,11 +444,15 @@ class IFC_PARSE_API InstanceData {
InstanceData(IfcParse::IfcFile* file, const IfcParse::declaration* declaration, uint32_t id, in_memory_attribute_storage&& storage)
: file_(file), declaration_(declaration), identity_(counter_++), id_(id), storage_(new in_memory_attribute_storage(std::move(storage)))
{}
{
populate_derived_();
}
InstanceData(IfcParse::IfcFile* file, const IfcParse::declaration* declaration, uint32_t id, rocks_db_attribute_storage&&)
: file_(file), declaration_(declaration), identity_(counter_++), id_(id), storage_(nullptr)
{}
{
populate_derived_();
}
/*
// now that there are referenced as shared_ptr there is no move constructor anymore
-4
View File
@@ -144,10 +144,6 @@ class IFC_PARSE_API Entity : public Base {
T get_value(const std::string& name, const T& default_value) const;
std::vector<express::Entity> get_inverse(const std::string& name) const;
// unsigned set_id(const std::optional<unsigned>& i);
void populate_derived();
};
class IFC_PARSE_API Select : public Base {