Hacky solution to disable schemas to speedup compilation

This commit is contained in:
Thomas Krijnen
2021-05-11 22:29:16 +02:00
parent ce76d27acc
commit 34386ea27c
12 changed files with 582 additions and 166 deletions
+24
View File
@@ -454,41 +454,53 @@ void IfcHierarchyHelper<Schema>::setSurfaceColour(typename Schema::IfcProductRep
}
}
#ifdef HAS_SCHEMA_2x3
Ifc2x3::IfcStyledItem* create_styled_item(Ifc2x3::IfcRepresentationItem* item, Ifc2x3::IfcPresentationStyleAssignment* style_assignment) {
Ifc2x3::IfcPresentationStyleAssignment::list::ptr style_assignments(new Ifc2x3::IfcPresentationStyleAssignment::list);
style_assignments->push(style_assignment);
return new Ifc2x3::IfcStyledItem(item, style_assignments, boost::none);
}
#endif
#ifdef HAS_SCHEMA_4
Ifc4::IfcStyledItem* create_styled_item(Ifc4::IfcRepresentationItem* item, Ifc4::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment);
return new Ifc4::IfcStyledItem(item, style_assignments, boost::none);
}
#endif
#ifdef HAS_SCHEMA_4x1
Ifc4x1::IfcStyledItem* create_styled_item(Ifc4x1::IfcRepresentationItem* item, Ifc4x1::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment);
return new Ifc4x1::IfcStyledItem(item, style_assignments, boost::none);
}
#endif
#ifdef HAS_SCHEMA_4x2
Ifc4x2::IfcStyledItem* create_styled_item(Ifc4x2::IfcRepresentationItem* item, Ifc4x2::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment);
return new Ifc4x2::IfcStyledItem(item, style_assignments, boost::none);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::IfcStyledItem* create_styled_item(Ifc4x3_rc1::IfcRepresentationItem* item, Ifc4x3_rc1::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment);
return new Ifc4x3_rc1::IfcStyledItem(item, style_assignments, boost::none);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::IfcStyledItem* create_styled_item(Ifc4x3_rc2::IfcRepresentationItem* item, Ifc4x3_rc2::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment);
return new Ifc4x3_rc2::IfcStyledItem(item, style_assignments, boost::none);
}
#endif
template <typename Schema>
void IfcHierarchyHelper<Schema>::setSurfaceColour(typename Schema::IfcRepresentation* rep,
@@ -582,9 +594,21 @@ typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::
}
}
#ifdef HAS_SCHEMA_2x3
template IFC_PARSE_API class IfcHierarchyHelper<Ifc2x3>;
#endif
#ifdef HAS_SCHEMA_4
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4>;
#endif
#ifdef HAS_SCHEMA_4x1
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x1>;
#endif
#ifdef HAS_SCHEMA_4x2
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x2>;
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x3_rc1>;
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x3_rc2>;
#endif
+128 -84
View File
@@ -32,12 +32,24 @@
#include "ifc_parse_api.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h"
#endif
#include "../ifcparse/IfcFile.h"
@@ -45,78 +57,150 @@
#include "../ifcparse/IfcGlobalId.h"
namespace {
IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatingObject")
);
}
#ifdef HAS_SCHEMA_2x3
Ifc2x3::IfcObjectDefinition* get_parent_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4::IfcObjectDefinition* get_parent_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4x1::IfcObjectDefinition* get_parent_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4x2::IfcObjectDefinition* get_parent_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4x3_rc1::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatedElements")
);
}
IfcEntityList::ptr get_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc2x3::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc2x3::IfcProduct>());
}
void set_children_of_relation(Ifc2x3::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc2x3::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4
Ifc4::IfcObjectDefinition* get_parent_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4::IfcProduct>());
}
void set_children_of_relation(Ifc4::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x1
Ifc4x1::IfcObjectDefinition* get_parent_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x1::IfcProduct>());
}
void set_children_of_relation(Ifc4x1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x1::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x2
Ifc4x2::IfcObjectDefinition* get_parent_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x2::IfcProduct>());
}
void set_children_of_relation(Ifc4x2::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x2::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x3_rc1::IfcProduct>());
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x3_rc1::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc2::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x3_rc2::IfcProduct>());
}
void set_children_of_relation(Ifc4x3_rc2::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x3_rc2::IfcObjectDefinition>());
}
#endif
IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatingObject")
);
}
IfcEntityList::ptr get_children_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatedElements")
);
}
void set_children_of_relation(IfcUtil::IfcBaseClass* t, IfcEntityList::ptr& cs) {
IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument;
attr->set(cs);
@@ -125,46 +209,6 @@ namespace {
attr
);
}
void set_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc2x3::IfcProduct>());
}
void set_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4::IfcProduct>());
}
void set_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x1::IfcProduct>());
}
void set_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x2::IfcProduct>());
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x3_rc1::IfcProduct>());
}
void set_children_of_relation(Ifc2x3::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc2x3::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4x1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x1::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4x2::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x2::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x3_rc1::IfcObjectDefinition>());
}
}
template <typename Schema>
class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile {
+40
View File
@@ -19,12 +19,24 @@
#include "IfcSIPrefix.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h"
#endif
double IfcParse::IfcSIPrefixToValue(const std::string& v) {
if ( v == "EXA" ) return 1.e18;
@@ -75,17 +87,45 @@ double IfcParse::get_SI_equivalent(typename Schema::IfcNamedUnit* named_unit) {
}
#if defined(_MSC_VER) && _MSC_VER < 1900
#ifdef HAS_SCHEMA_2x3
template double IfcParse::get_SI_equivalent<Ifc2x3>(Ifc2x3::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4
template double IfcParse::get_SI_equivalent<Ifc4>(Ifc4::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x1
template double IfcParse::get_SI_equivalent<Ifc4x1>(Ifc4x1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x2
template double IfcParse::get_SI_equivalent<Ifc4x2>(Ifc4x2::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template double IfcParse::get_SI_equivalent<Ifc4x3_rc1>(Ifc4x3_rc1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template double IfcParse::get_SI_equivalent<Ifc4x3_rc2>(Ifc4x3_rc2::IfcNamedUnit* named_unit);
#endif
#else
#ifdef HAS_SCHEMA_2x3
template double IfcParse::get_SI_equivalent<Ifc2x3>(typename Ifc2x3::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4
template double IfcParse::get_SI_equivalent<Ifc4>(typename Ifc4::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x1
template double IfcParse::get_SI_equivalent<Ifc4x1>(typename Ifc4x1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x2
template double IfcParse::get_SI_equivalent<Ifc4x2>(typename Ifc4x2::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template double IfcParse::get_SI_equivalent<Ifc4x3_rc1>(typename Ifc4x3_rc1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template double IfcParse::get_SI_equivalent<Ifc4x3_rc2>(typename Ifc4x3_rc2::IfcNamedUnit* named_unit);
#endif
#endif
+24
View File
@@ -76,21 +76,45 @@ void IfcParse::register_schema(schema_definition* s) {
}
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h"
#endif
const IfcParse::schema_definition* IfcParse::schema_by_name(const std::string& name) {
// TODO: initialize automatically somehow
#ifdef HAS_SCHEMA_2x3
Ifc2x3::get_schema();
#endif
#ifdef HAS_SCHEMA_4
Ifc4::get_schema();
#endif
#ifdef HAS_SCHEMA_4x1
Ifc4x1::get_schema();
#endif
#ifdef HAS_SCHEMA_4x2
Ifc4x2::get_schema();
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::get_schema();
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::get_schema();
#endif
std::map<std::string, const IfcParse::schema_definition*>::const_iterator it = schemas.find(boost::to_upper_copy(name));
if (it == schemas.end()) {