Skip to content

Commit 988094b

Browse files
committed
Resolving merge conflicts
1 parent f36d27f commit 988094b

File tree

9 files changed

+2602
-2578
lines changed

9 files changed

+2602
-2578
lines changed

src/ifcexpressparser/schema_class.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ def get_declared_type(type, emitted_names=None):
4040
return "new aggregation_type(aggregation_type::%(aggr_type)s_type, %(bound1)d, %(bound2)d, %(decl_type)s)" % locals()
4141
elif isinstance(type, nodes.BinaryType):
4242
return "new simple_type(simple_type::binary_type)"
43+
elif isinstance(type, nodes.StringType):
44+
return "new simple_type(simple_type::string_type)"
4345
elif isinstance(type, str):
4446
if mapping.schema.is_type(type) or mapping.schema.is_entity(type):
45-
if emitted_names is None or type in emitted_types:
47+
if emitted_names is None or type.lower() in emitted_types:
4648
return "new named_type(%s_type)" % type
4749
else:
4850
raise UnmetDependenciesException(type)
@@ -63,6 +65,9 @@ def find_inverse_name_and_index(entity_name, attribute_name):
6365
try: return et, attrs.index(attribute_name)
6466
except: pass
6567

68+
else:
69+
raise Exception("No declared type for <%r>" % type)
70+
6671
self.schema_name = mapping.schema.name.capitalize()
6772

6873
statements = ['',
@@ -79,25 +84,27 @@ def find_inverse_name_and_index(entity_name, attribute_name):
7984
for cpp_type, collection in collections_by_type:
8085
for name in collection.keys():
8186
statements.append('%(cpp_type)s* %(name)s_type = 0;' % locals())
82-
83-
statements.append('#ifdef _MSC_VER' )
84-
statements.append('#pragma optimize("", off)')
85-
statements.append('#endif' )
86-
87+
88+
statements.append("""
89+
#ifdef _MSC_VER
90+
#pragma optimize("", off)
91+
#endif
92+
""")
8793
statements.append('schema_definition* populate_schema() {')
8894

8995
emitted_types = set()
9096
while len(emitted_types) < len(mapping.schema.simpletypes):
9197
for name, type in mapping.schema.simpletypes.items():
92-
if name in emitted_types: continue
98+
if name.lower() in emitted_types: continue
9399

94100
try:
95101
declared_type = get_declared_type(type, emitted_types)
96102
except UnmetDependenciesException:
103+
# print("Unmet", repr(name))
97104
continue
98105

99106
statements.append(' %(name)s_type = new type_declaration(IfcSchema::Type::%(name)s, %(declared_type)s);' % locals())
100-
emitted_types.add(name)
107+
emitted_types.add(name.lower())
101108

102109
declared_types.append('%(name)s_type' % locals())
103110

@@ -113,11 +120,11 @@ def find_inverse_name_and_index(entity_name, attribute_name):
113120
emitted_entities = set()
114121
while len(emitted_entities) < len(mapping.schema.entities):
115122
for name, type in mapping.schema.entities.items():
116-
if name in emitted_entities: continue
117-
if len(type.supertypes) == 0 or set(type.supertypes) < emitted_entities:
123+
if name.lower() in emitted_entities: continue
124+
if len(type.supertypes) == 0 or set(map(lambda s: s.lower(), type.supertypes)) < emitted_entities:
118125
supertype = '0' if len(type.supertypes) == 0 else '%s_type' % type.supertypes[0]
119126
statements.append(' %(name)s_type = new entity(IfcSchema::Type::%(name)s, %(supertype)s);' % locals())
120-
emitted_entities.add(name)
127+
emitted_entities.add(name.lower())
121128

122129
declared_types.append('%(name)s_type' % locals())
123130

@@ -126,14 +133,14 @@ def find_inverse_name_and_index(entity_name, attribute_name):
126133
emitted_selects = set()
127134
while len(emitted_selects) < len(mapping.schema.selects):
128135
for name, type in mapping.schema.selects.items():
129-
if name in emitted_selects: continue
130-
if set(type.values) < emmited:
136+
if name.lower() in emitted_selects: continue
137+
if set(map(lambda s: s.lower(),type.values)) < emmited:
131138
statements.append(' {')
132139
statements.append(' std::vector<const declaration*> items; items.reserve(%d);' % len(type.values))
133140
statements.extend(map(lambda v: ' items.push_back(%s_type);' % v, sorted(type.values)))
134141
statements.append(' %(name)s_type = new select_type(IfcSchema::Type::%(name)s, items);' % locals())
135142
statements.append(' }')
136-
emitted_selects.add(name)
143+
emitted_selects.add(name.lower())
137144
emmited.add(name)
138145

139146
declared_types.append('%(name)s_type' % locals())
@@ -181,9 +188,11 @@ def find_inverse_name_and_index(entity_name, attribute_name):
181188

182189
statements.extend(('}',''))
183190

184-
statements.append('#ifdef _MSC_VER' )
185-
statements.append('#pragma optimize("", on)')
186-
statements.append('#endif' )
191+
statements.append("""
192+
#ifdef _MSC_VER
193+
#pragma optimize("", on)
194+
#endif
195+
""")
187196

188197
statements.extend(('const schema_definition& get_schema() {',
189198
'',

src/ifcexpressparser/templates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ class IFC_PARSE_API %(name)s %(superclass)s{
423423
%(inverse)s
424424
const IfcParse::entity& %(name)s::declaration() const { return *%(name)s_type; }
425425
Type::Enum %(name)s::Class() { return Type::%(name)s; }
426-
%(name)s::%(name)s(IfcEntityInstanceData* e) : %(superclass)s { if (!e) return; if (!e->is(Type::%(name)s)) throw IfcException("Unable to find find keyword in schema"); data_ = e; }
426+
%(name)s::%(name)s(IfcEntityInstanceData* e) : %(superclass)s { if (!e) return; if (e->type() != Type::%(name)s) throw IfcException("Unable to find find keyword in schema"); data_ = e; }
427427
%(name)s::%(name)s(%(constructor_arguments)s) : %(superclass)s {data_ = new IfcEntityInstanceData(Class()); %(constructor_implementation)s }
428428
"""
429429

@@ -469,7 +469,7 @@ class IFC_PARSE_API %(name)s %(superclass)s{
469469
constructor_stmt_array = "{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();attr->set((%(name)s)->generalize()" +");data_->setArgument(%(index)d,attr);}"
470470
constructor_stmt_derived = "{IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument();attr->set(IfcWrite::IfcWriteArgument::Derived()" +");data_->setArgument(%(index)d,attr);}"
471471

472-
constructor_stmt_optional = " if (%(name)s) {%(stmt)s } else { IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(boost::blank()); entity->setArgument(%(index)d, attr); }"
472+
constructor_stmt_optional = " if (%(name)s) {%(stmt)s } else { IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument(); attr->set(boost::blank()); data_->setArgument(%(index)d, attr); }"
473473

474474
inverse_implementation = " inverse_map[Type::%(type)s].insert(std::make_pair(\"%(name)s\", std::make_pair(Type::%(related_type)s, %(index)d)));"
475475

src/ifcparse/Ifc2x3-schema.cpp

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,11 @@ enumeration_type* IfcWindowPanelPositionEnum_type = 0;
10091009
enumeration_type* IfcWindowStyleConstructionEnum_type = 0;
10101010
enumeration_type* IfcWindowStyleOperationEnum_type = 0;
10111011
enumeration_type* IfcWorkControlTypeEnum_type = 0;
1012+
1013+
#ifdef _MSC_VER
1014+
#pragma optimize("", off)
1015+
#endif
1016+
10121017
schema_definition* populate_schema() {
10131018
IfcAbsorbedDoseMeasure_type = new type_declaration(IfcSchema::Type::IfcAbsorbedDoseMeasure, new simple_type(simple_type::real_type));
10141019
IfcAccelerationMeasure_type = new type_declaration(IfcSchema::Type::IfcAccelerationMeasure, new simple_type(simple_type::real_type));
@@ -1023,7 +1028,7 @@ schema_definition* populate_schema() {
10231028
IfcCurvatureMeasure_type = new type_declaration(IfcSchema::Type::IfcCurvatureMeasure, new simple_type(simple_type::real_type));
10241029
IfcDayInMonthNumber_type = new type_declaration(IfcSchema::Type::IfcDayInMonthNumber, new simple_type(simple_type::integer_type));
10251030
IfcDaylightSavingHour_type = new type_declaration(IfcSchema::Type::IfcDaylightSavingHour, new simple_type(simple_type::integer_type));
1026-
IfcDescriptiveMeasure_type = new type_declaration(IfcSchema::Type::IfcDescriptiveMeasure, None);
1031+
IfcDescriptiveMeasure_type = new type_declaration(IfcSchema::Type::IfcDescriptiveMeasure, new simple_type(simple_type::string_type));
10271032
IfcDimensionCount_type = new type_declaration(IfcSchema::Type::IfcDimensionCount, new simple_type(simple_type::integer_type));
10281033
IfcDoseEquivalentMeasure_type = new type_declaration(IfcSchema::Type::IfcDoseEquivalentMeasure, new simple_type(simple_type::real_type));
10291034
IfcDynamicViscosityMeasure_type = new type_declaration(IfcSchema::Type::IfcDynamicViscosityMeasure, new simple_type(simple_type::real_type));
@@ -1034,24 +1039,24 @@ schema_definition* populate_schema() {
10341039
IfcElectricResistanceMeasure_type = new type_declaration(IfcSchema::Type::IfcElectricResistanceMeasure, new simple_type(simple_type::real_type));
10351040
IfcElectricVoltageMeasure_type = new type_declaration(IfcSchema::Type::IfcElectricVoltageMeasure, new simple_type(simple_type::real_type));
10361041
IfcEnergyMeasure_type = new type_declaration(IfcSchema::Type::IfcEnergyMeasure, new simple_type(simple_type::real_type));
1037-
IfcFontStyle_type = new type_declaration(IfcSchema::Type::IfcFontStyle, None);
1038-
IfcFontVariant_type = new type_declaration(IfcSchema::Type::IfcFontVariant, None);
1039-
IfcFontWeight_type = new type_declaration(IfcSchema::Type::IfcFontWeight, None);
1042+
IfcFontStyle_type = new type_declaration(IfcSchema::Type::IfcFontStyle, new simple_type(simple_type::string_type));
1043+
IfcFontVariant_type = new type_declaration(IfcSchema::Type::IfcFontVariant, new simple_type(simple_type::string_type));
1044+
IfcFontWeight_type = new type_declaration(IfcSchema::Type::IfcFontWeight, new simple_type(simple_type::string_type));
10401045
IfcForceMeasure_type = new type_declaration(IfcSchema::Type::IfcForceMeasure, new simple_type(simple_type::real_type));
10411046
IfcFrequencyMeasure_type = new type_declaration(IfcSchema::Type::IfcFrequencyMeasure, new simple_type(simple_type::real_type));
1042-
IfcGloballyUniqueId_type = new type_declaration(IfcSchema::Type::IfcGloballyUniqueId, None);
1047+
IfcGloballyUniqueId_type = new type_declaration(IfcSchema::Type::IfcGloballyUniqueId, new simple_type(simple_type::string_type));
10431048
IfcHeatFluxDensityMeasure_type = new type_declaration(IfcSchema::Type::IfcHeatFluxDensityMeasure, new simple_type(simple_type::real_type));
10441049
IfcHeatingValueMeasure_type = new type_declaration(IfcSchema::Type::IfcHeatingValueMeasure, new simple_type(simple_type::real_type));
10451050
IfcHourInDay_type = new type_declaration(IfcSchema::Type::IfcHourInDay, new simple_type(simple_type::integer_type));
1046-
IfcIdentifier_type = new type_declaration(IfcSchema::Type::IfcIdentifier, None);
1051+
IfcIdentifier_type = new type_declaration(IfcSchema::Type::IfcIdentifier, new simple_type(simple_type::string_type));
10471052
IfcIlluminanceMeasure_type = new type_declaration(IfcSchema::Type::IfcIlluminanceMeasure, new simple_type(simple_type::real_type));
10481053
IfcInductanceMeasure_type = new type_declaration(IfcSchema::Type::IfcInductanceMeasure, new simple_type(simple_type::real_type));
10491054
IfcInteger_type = new type_declaration(IfcSchema::Type::IfcInteger, new simple_type(simple_type::integer_type));
10501055
IfcIntegerCountRateMeasure_type = new type_declaration(IfcSchema::Type::IfcIntegerCountRateMeasure, new simple_type(simple_type::integer_type));
10511056
IfcIonConcentrationMeasure_type = new type_declaration(IfcSchema::Type::IfcIonConcentrationMeasure, new simple_type(simple_type::real_type));
10521057
IfcIsothermalMoistureCapacityMeasure_type = new type_declaration(IfcSchema::Type::IfcIsothermalMoistureCapacityMeasure, new simple_type(simple_type::real_type));
10531058
IfcKinematicViscosityMeasure_type = new type_declaration(IfcSchema::Type::IfcKinematicViscosityMeasure, new simple_type(simple_type::real_type));
1054-
IfcLabel_type = new type_declaration(IfcSchema::Type::IfcLabel, None);
1059+
IfcLabel_type = new type_declaration(IfcSchema::Type::IfcLabel, new simple_type(simple_type::string_type));
10551060
IfcLengthMeasure_type = new type_declaration(IfcSchema::Type::IfcLengthMeasure, new simple_type(simple_type::real_type));
10561061
IfcLinearForceMeasure_type = new type_declaration(IfcSchema::Type::IfcLinearForceMeasure, new simple_type(simple_type::real_type));
10571062
IfcLinearMomentMeasure_type = new type_declaration(IfcSchema::Type::IfcLinearMomentMeasure, new simple_type(simple_type::real_type));
@@ -1085,7 +1090,7 @@ schema_definition* populate_schema() {
10851090
IfcPositiveLengthMeasure_type = new type_declaration(IfcSchema::Type::IfcPositiveLengthMeasure, new named_type(IfcLengthMeasure_type));
10861091
IfcPositivePlaneAngleMeasure_type = new type_declaration(IfcSchema::Type::IfcPositivePlaneAngleMeasure, new named_type(IfcPlaneAngleMeasure_type));
10871092
IfcPowerMeasure_type = new type_declaration(IfcSchema::Type::IfcPowerMeasure, new simple_type(simple_type::real_type));
1088-
IfcPresentableText_type = new type_declaration(IfcSchema::Type::IfcPresentableText, None);
1093+
IfcPresentableText_type = new type_declaration(IfcSchema::Type::IfcPresentableText, new simple_type(simple_type::string_type));
10891094
IfcPressureMeasure_type = new type_declaration(IfcSchema::Type::IfcPressureMeasure, new simple_type(simple_type::real_type));
10901095
IfcRadioActivityMeasure_type = new type_declaration(IfcSchema::Type::IfcRadioActivityMeasure, new simple_type(simple_type::real_type));
10911096
IfcRatioMeasure_type = new type_declaration(IfcSchema::Type::IfcRatioMeasure, new simple_type(simple_type::real_type));
@@ -1104,11 +1109,11 @@ schema_definition* populate_schema() {
11041109
IfcSpecularExponent_type = new type_declaration(IfcSchema::Type::IfcSpecularExponent, new simple_type(simple_type::real_type));
11051110
IfcSpecularRoughness_type = new type_declaration(IfcSchema::Type::IfcSpecularRoughness, new simple_type(simple_type::real_type));
11061111
IfcTemperatureGradientMeasure_type = new type_declaration(IfcSchema::Type::IfcTemperatureGradientMeasure, new simple_type(simple_type::real_type));
1107-
IfcText_type = new type_declaration(IfcSchema::Type::IfcText, None);
1108-
IfcTextAlignment_type = new type_declaration(IfcSchema::Type::IfcTextAlignment, None);
1109-
IfcTextDecoration_type = new type_declaration(IfcSchema::Type::IfcTextDecoration, None);
1110-
IfcTextFontName_type = new type_declaration(IfcSchema::Type::IfcTextFontName, None);
1111-
IfcTextTransformation_type = new type_declaration(IfcSchema::Type::IfcTextTransformation, None);
1112+
IfcText_type = new type_declaration(IfcSchema::Type::IfcText, new simple_type(simple_type::string_type));
1113+
IfcTextAlignment_type = new type_declaration(IfcSchema::Type::IfcTextAlignment, new simple_type(simple_type::string_type));
1114+
IfcTextDecoration_type = new type_declaration(IfcSchema::Type::IfcTextDecoration, new simple_type(simple_type::string_type));
1115+
IfcTextFontName_type = new type_declaration(IfcSchema::Type::IfcTextFontName, new simple_type(simple_type::string_type));
1116+
IfcTextTransformation_type = new type_declaration(IfcSchema::Type::IfcTextTransformation, new simple_type(simple_type::string_type));
11121117
IfcThermalAdmittanceMeasure_type = new type_declaration(IfcSchema::Type::IfcThermalAdmittanceMeasure, new simple_type(simple_type::real_type));
11131118
IfcThermalConductivityMeasure_type = new type_declaration(IfcSchema::Type::IfcThermalConductivityMeasure, new simple_type(simple_type::real_type));
11141119
IfcThermalExpansionCoefficientMeasure_type = new type_declaration(IfcSchema::Type::IfcThermalExpansionCoefficientMeasure, new simple_type(simple_type::real_type));
@@ -8867,7 +8872,7 @@ schema_definition* populate_schema() {
88678872
}
88688873
{
88698874
std::vector<const entity::attribute*> attributes; attributes.reserve(2);
8870-
attributes.push_back(new entity::attribute("Name", None, false));
8875+
attributes.push_back(new entity::attribute("Name", new simple_type(simple_type::string_type), false));
88718876
attributes.push_back(new entity::attribute("Rows", new aggregation_type(aggregation_type::list_type, 1, -1, new named_type(IfcTableRow_type)), false));
88728877
std::vector<bool> derived; derived.reserve(2);
88738878
derived.push_back(false); derived.push_back(false);
@@ -10374,6 +10379,11 @@ schema_definition* populate_schema() {
1037410379
return new schema_definition("IFC2X3", declarations, true);
1037510380
}
1037610381

10382+
10383+
#ifdef _MSC_VER
10384+
#pragma optimize("", on)
10385+
#endif
10386+
1037710387
const schema_definition& get_schema() {
1037810388

1037910389
static const schema_definition* s = populate_schema();

0 commit comments

Comments
 (0)