Run codegen for header schema

This commit is contained in:
Thomas Krijnen
2025-02-26 09:25:04 +01:00
parent 1d9dcb3ab7
commit c0f148cd3c
3 changed files with 226 additions and 0 deletions
@@ -0,0 +1,51 @@
#include "../ifcparse/IfcSchema.h"
#include "../ifcparse/Header_section_schema.h"
#include <string>
using namespace std::string_literals;
using namespace IfcParse;
declaration* header_section_schema_types[5] = {nullptr};
const std::string strings[] = {"schema_name"s,"time_stamp_text"s,"file_description"s,"file_name"s,"file_schema"s,"description"s,"implementation_level"s,"name"s,"time_stamp"s,"author"s,"organization"s,"preprocessor_version"s,"originating_system"s,"authorisation"s,"schema_identifiers"s,"header_section_schema"s};
class header_section_schema_instance_factory : public IfcParse::instance_factory {
virtual IfcUtil::IfcBaseClass* operator()(const IfcParse::declaration* decl, IfcEntityInstanceData&& data) const {
switch(decl->index_in_schema()) {
case 0: return new ::Header_section_schema::file_description(std::move(data));
case 1: return new ::Header_section_schema::file_name(std::move(data));
case 2: return new ::Header_section_schema::file_schema(std::move(data));
case 3: return new ::Header_section_schema::schema_name(std::move(data));
case 4: return new ::Header_section_schema::time_stamp_text(std::move(data));
default: throw IfcParse::IfcException(decl->name() + " cannot be instantiated");
}
}
};
IfcParse::schema_definition* header_section_schema_populate_schema() {
header_section_schema_types[3] = new type_declaration(strings[0], 3, new simple_type(simple_type::string_type));
header_section_schema_types[4] = new type_declaration(strings[1], 4, new simple_type(simple_type::string_type));
header_section_schema_types[0] = new entity(strings[2], false, 0, (entity*) 0);
header_section_schema_types[1] = new entity(strings[3], false, 1, (entity*) 0);
header_section_schema_types[2] = new entity(strings[4], false, 2, (entity*) 0);
((entity*)header_section_schema_types[0])->set_attributes({new attribute(strings[5], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[6], new simple_type(simple_type::string_type), false)}, {false,false});
((entity*)header_section_schema_types[1])->set_attributes({new attribute(strings[7], new simple_type(simple_type::string_type), false),new attribute(strings[8], new named_type(header_section_schema_HEADER_SECTION_SCHEMA_types[4]_type), false),new attribute(strings[9], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[10], new aggregation_type(aggregation_type::list_type, 1, -1, new simple_type(simple_type::string_type)), false),new attribute(strings[11], new simple_type(simple_type::string_type), false),new attribute(strings[12], new simple_type(simple_type::string_type), false),new attribute(strings[13], new simple_type(simple_type::string_type), false)}, {false,false,false,false,false,false,false});
((entity*)header_section_schema_types[2])->set_attributes({new attribute(strings[14], new aggregation_type(aggregation_type::list_type, 1, -1, new named_type(header_section_schema_HEADER_SECTION_SCHEMA_types[3]_type)), false)}, {false});
return new schema_definition(strings[15], {header_section_schema_types[0],header_section_schema_types[1],header_section_schema_types[2],header_section_schema_types[3],header_section_schema_types[4]}, new header_section_schema_instance_factory());
}
static std::unique_ptr<schema_definition> schema;
void Header_section_schema::clear_schema() {
schema.reset();
}
const schema_definition& Header_section_schema::get_schema() {
if (!schema) {
schema.reset(header_section_schema_populate_schema());
}
return *schema;
}
+76
View File
@@ -0,0 +1,76 @@
#include "../ifcparse/Header_section_schema.h"
#include "../ifcparse/IfcSchema.h"
#include "../ifcparse/IfcException.h"
#include "../ifcparse/IfcFile.h"
#include <map>
const char* const Header_section_schema::Identifier = "HEADER_SECTION_SCHEMA";
using namespace IfcParse;
// External definitions
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]); }
const IfcParse::type_declaration& Header_section_schema::schema_name::declaration() const { return *((IfcParse::type_declaration*)HEADER_SECTION_SCHEMA_types[3]); }
Header_section_schema::schema_name::schema_name(IfcEntityInstanceData&& e) : IfcUtil::IfcBaseType(std::move(e)) { }
Header_section_schema::schema_name::schema_name(std::string v) : IfcUtil::IfcBaseType() { set_attribute_value(0, v); }
Header_section_schema::schema_name::operator std::string() const { return get_attribute_value(0); }
// 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]); }
const IfcParse::type_declaration& Header_section_schema::time_stamp_text::declaration() const { return *((IfcParse::type_declaration*)HEADER_SECTION_SCHEMA_types[4]); }
Header_section_schema::time_stamp_text::time_stamp_text(IfcEntityInstanceData&& e) : IfcUtil::IfcBaseType(std::move(e)) { }
Header_section_schema::time_stamp_text::time_stamp_text(std::string v) : IfcUtil::IfcBaseType() { set_attribute_value(0, v); }
Header_section_schema::time_stamp_text::operator std::string() const { return get_attribute_value(0); }
// Function implementations for file_description
std::vector< std::string > /*[1:?]*/ Header_section_schema::file_description::description() const { std::vector< std::string > /*[1:?]*/ v = get_attribute_value(0); return v; }
void Header_section_schema::file_description::setdescription(std::vector< std::string > /*[1:?]*/ v) { set_attribute_value(0, v);if constexpr (false)unset_attribute_value(0); }
std::string Header_section_schema::file_description::implementation_level() const { std::string v = get_attribute_value(1); return v; }
void Header_section_schema::file_description::setimplementation_level(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(IfcEntityInstanceData&& e) : IfcUtil::IfcBaseEntity(std::move(e)) { }
Header_section_schema::file_description::file_description(std::vector< std::string > /*[1:?]*/ v1_description, std::string v2_implementation_level) : IfcUtil::IfcBaseEntity(IfcEntityInstanceData(in_memory_attribute_storage(2))) { set_attribute_value(0, (v1_description));set_attribute_value(1, (v2_implementation_level));; populate_derived(); }
// Function implementations for file_name
std::string Header_section_schema::file_name::name() const { std::string v = get_attribute_value(0); return v; }
void Header_section_schema::file_name::setname(std::string v) { set_attribute_value(0, v);if constexpr (false)unset_attribute_value(0); }
std::string Header_section_schema::file_name::time_stamp() const { std::string v = get_attribute_value(1); return v; }
void Header_section_schema::file_name::settime_stamp(std::string v) { set_attribute_value(1, v);if constexpr (false)unset_attribute_value(1); }
std::vector< std::string > /*[1:?]*/ Header_section_schema::file_name::author() const { std::vector< std::string > /*[1:?]*/ v = get_attribute_value(2); return v; }
void Header_section_schema::file_name::setauthor(std::vector< std::string > /*[1:?]*/ v) { set_attribute_value(2, v);if constexpr (false)unset_attribute_value(2); }
std::vector< std::string > /*[1:?]*/ Header_section_schema::file_name::organization() const { std::vector< std::string > /*[1:?]*/ v = get_attribute_value(3); return v; }
void Header_section_schema::file_name::setorganization(std::vector< std::string > /*[1:?]*/ v) { set_attribute_value(3, v);if constexpr (false)unset_attribute_value(3); }
std::string Header_section_schema::file_name::preprocessor_version() const { std::string v = get_attribute_value(4); return v; }
void Header_section_schema::file_name::setpreprocessor_version(std::string v) { set_attribute_value(4, v);if constexpr (false)unset_attribute_value(4); }
std::string Header_section_schema::file_name::originating_system() const { std::string v = get_attribute_value(5); return v; }
void Header_section_schema::file_name::setoriginating_system(std::string v) { set_attribute_value(5, v);if constexpr (false)unset_attribute_value(5); }
std::string Header_section_schema::file_name::authorisation() const { std::string v = get_attribute_value(6); return v; }
void Header_section_schema::file_name::setauthorisation(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(IfcEntityInstanceData&& e) : IfcUtil::IfcBaseEntity(std::move(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_authorisation) : IfcUtil::IfcBaseEntity(IfcEntityInstanceData(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_authorisation));; populate_derived(); }
// 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(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(IfcEntityInstanceData&& e) : IfcUtil::IfcBaseEntity(std::move(e)) { }
Header_section_schema::file_schema::file_schema(std::vector< std::string > /*[1:?]*/ v1_schema_identifiers) : IfcUtil::IfcBaseEntity(IfcEntityInstanceData(in_memory_attribute_storage(1))) { set_attribute_value(0, (v1_schema_identifiers));; populate_derived(); }
+99
View File
@@ -0,0 +1,99 @@
#ifndef HEADER_SECTION_SCHEMA_H
#define HEADER_SECTION_SCHEMA_H
#include <string>
#include <vector>
#include <boost/optional.hpp>
#include "../ifcparse/ifc_parse_api.h"
#include "../ifcparse/aggregate_of_instance.h"
#include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/IfcSchema.h"
#include "../ifcparse/IfcException.h"
#include "../ifcparse/Argument.h"
struct Header_section_schema {
IFC_PARSE_API static const IfcParse::schema_definition& get_schema();
IFC_PARSE_API static void clear_schema();
static const char* const Identifier;
// Forward definitions
class file_description; class file_name; class file_schema; class schema_name; class time_stamp_text;
class IFC_PARSE_API schema_name : public IfcUtil::IfcBaseType {
public:
virtual const IfcParse::type_declaration& declaration() const;
static const IfcParse::type_declaration& Class();
explicit schema_name (IfcEntityInstanceData&& e);
schema_name (std::string v);
operator std::string() const;
};
class IFC_PARSE_API time_stamp_text : public IfcUtil::IfcBaseType {
public:
virtual const IfcParse::type_declaration& declaration() const;
static const IfcParse::type_declaration& Class();
explicit time_stamp_text (IfcEntityInstanceData&& e);
time_stamp_text (std::string v);
operator std::string() const;
};
class IFC_PARSE_API file_description : public IfcUtil::IfcBaseEntity {
public:
std::vector< std::string > /*[1:?]*/ description() const;
void setdescription(std::vector< std::string > /*[1:?]*/ v);
std::string implementation_level() const;
void setimplementation_level(std::string v);
virtual const IfcParse::entity& declaration() const;
static const IfcParse::entity& Class();
file_description (IfcEntityInstanceData&& e);
file_description (std::vector< std::string > /*[1:?]*/ v1_description, std::string v2_implementation_level);
typedef aggregate_of< file_description > list;
};
class IFC_PARSE_API file_name : public IfcUtil::IfcBaseEntity {
public:
std::string name() const;
void setname(std::string v);
std::string time_stamp() const;
void settime_stamp(std::string v);
std::vector< std::string > /*[1:?]*/ author() const;
void setauthor(std::vector< std::string > /*[1:?]*/ v);
std::vector< std::string > /*[1:?]*/ organization() const;
void setorganization(std::vector< std::string > /*[1:?]*/ v);
std::string preprocessor_version() const;
void setpreprocessor_version(std::string v);
std::string originating_system() const;
void setoriginating_system(std::string v);
std::string authorisation() const;
void setauthorisation(std::string v);
virtual const IfcParse::entity& declaration() const;
static const IfcParse::entity& Class();
file_name (IfcEntityInstanceData&& e);
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_authorisation);
typedef aggregate_of< file_name > list;
};
class IFC_PARSE_API file_schema : public IfcUtil::IfcBaseEntity {
public:
std::vector< std::string > /*[1:?]*/ schema_identifiers() const;
void setschema_identifiers(std::vector< std::string > /*[1:?]*/ v);
virtual const IfcParse::entity& declaration() const;
static const IfcParse::entity& Class();
file_schema (IfcEntityInstanceData&& e);
file_schema (std::vector< std::string > /*[1:?]*/ v1_schema_identifiers);
typedef aggregate_of< file_schema > list;
};
};
#endif