Merge pull request #1 from aothms/master

This commit is contained in:
Yorik van Havre
2012-10-30 04:47:28 -07:00
parent 3bc3331983
commit ed5f879b9f
10 changed files with 41 additions and 714 deletions
+6 -5
View File
@@ -543,7 +543,7 @@ using boost::optional;
namespace %(schema)s {
"""%{'schema_upper':schema_version.upper(),'schema':schema_version}
simple_enumerations = sorted(simple_types)
simple_enumerations = sorted(selectable_simple_types)
entity_enumerations = sorted(entity_names)
all_enumerations = simple_enumerations + entity_enumerations
@@ -613,6 +613,11 @@ while True:
print >>h_file, c
print >>h_file, "void InitStringMap();"
print >>h_file, "void InitAttributeCountMap();"
print >>h_file, "void InitAttributeIndexMap();"
print >>h_file, "void InitAttributeTypeMap();"
print >>h_file, "void InitAttributeNameMap();"
print >>h_file, "void InitAttributeOptionalMap();"
print >>h_file, "IfcSchemaEntity SchemaEntity(IfcAbstractEntityPtr e = 0);"
print >>h_file, "}\n\n#endif"
@@ -661,10 +666,6 @@ maxlen = max([len(e) for e in all_enumerations])
string_map,attribute_count_map,attribute_index_map,attribute_name_map,attribute_optional_map,attribute_type_map = [""]*6
print >>cpp2_file, "void InitDescriptorMap() {"
print >>cpp2_file, " IfcEntityDescriptor* current;"
for k,v in simple_types.items():
if k in enumerations or k in selections: continue
print >>cpp2_file, " current = entity_descriptor_map[Type::%s] = new IfcEntityDescriptor(Type::%s,0);"%(k,k)
print >>cpp2_file, " current->add(\"wrappedValue\",false,%s);"%(v.type_enum())
rt_entities = set()
while True:
todo = [e for e in entities if e.class_name not in rt_entities]
+7 -234
View File
@@ -34,243 +34,16 @@
using namespace Ifc2x3;
using namespace IfcParse;
using namespace IfcWrite;
std::map<Type::Enum,unsigned char> attribute_count_map;
typedef std::pair<Type::Enum,std::string> EntityNamedAttribute;
typedef std::pair<Type::Enum,unsigned char> EntityAttribute;
std::map<EntityNamedAttribute,unsigned char> attribute_map;
std::map<EntityAttribute,ArgumentType> attribute_type_map;
std::map<EntityAttribute,std::string> attribute_name_map;
std::set<EntityAttribute> attribute_optional_map;
std::map<Type::Enum,IfcEntityDescriptor*> entity_descriptor_map;
void InitDescriptorMap() {
IfcEntityDescriptor* current;
current = entity_descriptor_map[Type::IfcSoundPowerMeasure] = new IfcEntityDescriptor(Type::IfcSoundPowerMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcRotationalFrequencyMeasure] = new IfcEntityDescriptor(Type::IfcRotationalFrequencyMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcSpecificHeatCapacityMeasure] = new IfcEntityDescriptor(Type::IfcSpecificHeatCapacityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcHeatingValueMeasure] = new IfcEntityDescriptor(Type::IfcHeatingValueMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMassDensityMeasure] = new IfcEntityDescriptor(Type::IfcMassDensityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcElectricConductanceMeasure] = new IfcEntityDescriptor(Type::IfcElectricConductanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcModulusOfElasticityMeasure] = new IfcEntityDescriptor(Type::IfcModulusOfElasticityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcRotationalMassMeasure] = new IfcEntityDescriptor(Type::IfcRotationalMassMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcTextDecoration] = new IfcEntityDescriptor(Type::IfcTextDecoration,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcPositiveLengthMeasure] = new IfcEntityDescriptor(Type::IfcPositiveLengthMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcAmountOfSubstanceMeasure] = new IfcEntityDescriptor(Type::IfcAmountOfSubstanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcAngularVelocityMeasure] = new IfcEntityDescriptor(Type::IfcAngularVelocityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMonthInYearNumber] = new IfcEntityDescriptor(Type::IfcMonthInYearNumber,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcCurvatureMeasure] = new IfcEntityDescriptor(Type::IfcCurvatureMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcIonConcentrationMeasure] = new IfcEntityDescriptor(Type::IfcIonConcentrationMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcHeatFluxDensityMeasure] = new IfcEntityDescriptor(Type::IfcHeatFluxDensityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcFontVariant] = new IfcEntityDescriptor(Type::IfcFontVariant,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcThermalResistanceMeasure] = new IfcEntityDescriptor(Type::IfcThermalResistanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPositiveRatioMeasure] = new IfcEntityDescriptor(Type::IfcPositiveRatioMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMinuteInHour] = new IfcEntityDescriptor(Type::IfcMinuteInHour,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcMolecularWeightMeasure] = new IfcEntityDescriptor(Type::IfcMolecularWeightMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLinearMomentMeasure] = new IfcEntityDescriptor(Type::IfcLinearMomentMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcElectricCurrentMeasure] = new IfcEntityDescriptor(Type::IfcElectricCurrentMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcDaylightSavingHour] = new IfcEntityDescriptor(Type::IfcDaylightSavingHour,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcNormalisedRatioMeasure] = new IfcEntityDescriptor(Type::IfcNormalisedRatioMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcContextDependentMeasure] = new IfcEntityDescriptor(Type::IfcContextDependentMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcFontStyle] = new IfcEntityDescriptor(Type::IfcFontStyle,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcYearNumber] = new IfcEntityDescriptor(Type::IfcYearNumber,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcLabel] = new IfcEntityDescriptor(Type::IfcLabel,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcTimeStamp] = new IfcEntityDescriptor(Type::IfcTimeStamp,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcNumericMeasure] = new IfcEntityDescriptor(Type::IfcNumericMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcKinematicViscosityMeasure] = new IfcEntityDescriptor(Type::IfcKinematicViscosityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcBoxAlignment] = new IfcEntityDescriptor(Type::IfcBoxAlignment,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcHourInDay] = new IfcEntityDescriptor(Type::IfcHourInDay,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcIsothermalMoistureCapacityMeasure] = new IfcEntityDescriptor(Type::IfcIsothermalMoistureCapacityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcIdentifier] = new IfcEntityDescriptor(Type::IfcIdentifier,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcRadioActivityMeasure] = new IfcEntityDescriptor(Type::IfcRadioActivityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcReal] = new IfcEntityDescriptor(Type::IfcReal,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcTextTransformation] = new IfcEntityDescriptor(Type::IfcTextTransformation,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcThermalTransmittanceMeasure] = new IfcEntityDescriptor(Type::IfcThermalTransmittanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcInductanceMeasure] = new IfcEntityDescriptor(Type::IfcInductanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcWarpingMomentMeasure] = new IfcEntityDescriptor(Type::IfcWarpingMomentMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcDynamicViscosityMeasure] = new IfcEntityDescriptor(Type::IfcDynamicViscosityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcComplexNumber] = new IfcEntityDescriptor(Type::IfcComplexNumber,0);
current->add("wrappedValue",false,Argument_VECTOR_DOUBLE);
current = entity_descriptor_map[Type::IfcModulusOfLinearSubgradeReactionMeasure] = new IfcEntityDescriptor(Type::IfcModulusOfLinearSubgradeReactionMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcDayInMonthNumber] = new IfcEntityDescriptor(Type::IfcDayInMonthNumber,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcThermalConductivityMeasure] = new IfcEntityDescriptor(Type::IfcThermalConductivityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcEnergyMeasure] = new IfcEntityDescriptor(Type::IfcEnergyMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcRotationalStiffnessMeasure] = new IfcEntityDescriptor(Type::IfcRotationalStiffnessMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPowerMeasure] = new IfcEntityDescriptor(Type::IfcPowerMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcThermalExpansionCoefficientMeasure] = new IfcEntityDescriptor(Type::IfcThermalExpansionCoefficientMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcTorqueMeasure] = new IfcEntityDescriptor(Type::IfcTorqueMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMassPerLengthMeasure] = new IfcEntityDescriptor(Type::IfcMassPerLengthMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcCountMeasure] = new IfcEntityDescriptor(Type::IfcCountMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcFontWeight] = new IfcEntityDescriptor(Type::IfcFontWeight,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcVolumetricFlowRateMeasure] = new IfcEntityDescriptor(Type::IfcVolumetricFlowRateMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLuminousFluxMeasure] = new IfcEntityDescriptor(Type::IfcLuminousFluxMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcModulusOfSubgradeReactionMeasure] = new IfcEntityDescriptor(Type::IfcModulusOfSubgradeReactionMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMassFlowRateMeasure] = new IfcEntityDescriptor(Type::IfcMassFlowRateMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcAreaMeasure] = new IfcEntityDescriptor(Type::IfcAreaMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcVolumeMeasure] = new IfcEntityDescriptor(Type::IfcVolumeMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMonetaryMeasure] = new IfcEntityDescriptor(Type::IfcMonetaryMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcTemperatureGradientMeasure] = new IfcEntityDescriptor(Type::IfcTemperatureGradientMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcModulusOfRotationalSubgradeReactionMeasure] = new IfcEntityDescriptor(Type::IfcModulusOfRotationalSubgradeReactionMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcTextAlignment] = new IfcEntityDescriptor(Type::IfcTextAlignment,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcSectionalAreaIntegralMeasure] = new IfcEntityDescriptor(Type::IfcSectionalAreaIntegralMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPresentableText] = new IfcEntityDescriptor(Type::IfcPresentableText,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcVaporPermeabilityMeasure] = new IfcEntityDescriptor(Type::IfcVaporPermeabilityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLinearVelocityMeasure] = new IfcEntityDescriptor(Type::IfcLinearVelocityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcIntegerCountRateMeasure] = new IfcEntityDescriptor(Type::IfcIntegerCountRateMeasure,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcLengthMeasure] = new IfcEntityDescriptor(Type::IfcLengthMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPlanarForceMeasure] = new IfcEntityDescriptor(Type::IfcPlanarForceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcInteger] = new IfcEntityDescriptor(Type::IfcInteger,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcElectricChargeMeasure] = new IfcEntityDescriptor(Type::IfcElectricChargeMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPlaneAngleMeasure] = new IfcEntityDescriptor(Type::IfcPlaneAngleMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcTextFontName] = new IfcEntityDescriptor(Type::IfcTextFontName,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcElectricVoltageMeasure] = new IfcEntityDescriptor(Type::IfcElectricVoltageMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcSoundPressureMeasure] = new IfcEntityDescriptor(Type::IfcSoundPressureMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcSpecularRoughness] = new IfcEntityDescriptor(Type::IfcSpecularRoughness,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcIlluminanceMeasure] = new IfcEntityDescriptor(Type::IfcIlluminanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcText] = new IfcEntityDescriptor(Type::IfcText,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcTimeMeasure] = new IfcEntityDescriptor(Type::IfcTimeMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcAccelerationMeasure] = new IfcEntityDescriptor(Type::IfcAccelerationMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLuminousIntensityMeasure] = new IfcEntityDescriptor(Type::IfcLuminousIntensityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcElectricCapacitanceMeasure] = new IfcEntityDescriptor(Type::IfcElectricCapacitanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcThermodynamicTemperatureMeasure] = new IfcEntityDescriptor(Type::IfcThermodynamicTemperatureMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcGloballyUniqueId] = new IfcEntityDescriptor(Type::IfcGloballyUniqueId,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcMagneticFluxMeasure] = new IfcEntityDescriptor(Type::IfcMagneticFluxMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcSolidAngleMeasure] = new IfcEntityDescriptor(Type::IfcSolidAngleMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcFrequencyMeasure] = new IfcEntityDescriptor(Type::IfcFrequencyMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPHMeasure] = new IfcEntityDescriptor(Type::IfcPHMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPositivePlaneAngleMeasure] = new IfcEntityDescriptor(Type::IfcPositivePlaneAngleMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcSecondInMinute] = new IfcEntityDescriptor(Type::IfcSecondInMinute,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcThermalAdmittanceMeasure] = new IfcEntityDescriptor(Type::IfcThermalAdmittanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcSpecularExponent] = new IfcEntityDescriptor(Type::IfcSpecularExponent,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcDimensionCount] = new IfcEntityDescriptor(Type::IfcDimensionCount,0);
current->add("wrappedValue",false,Argument_INT);
current = entity_descriptor_map[Type::IfcLinearStiffnessMeasure] = new IfcEntityDescriptor(Type::IfcLinearStiffnessMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcCompoundPlaneAngleMeasure] = new IfcEntityDescriptor(Type::IfcCompoundPlaneAngleMeasure,0);
current->add("wrappedValue",false,Argument_VECTOR_INT);
current = entity_descriptor_map[Type::IfcAbsorbedDoseMeasure] = new IfcEntityDescriptor(Type::IfcAbsorbedDoseMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcParameterValue] = new IfcEntityDescriptor(Type::IfcParameterValue,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLinearForceMeasure] = new IfcEntityDescriptor(Type::IfcLinearForceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcDescriptiveMeasure] = new IfcEntityDescriptor(Type::IfcDescriptiveMeasure,0);
current->add("wrappedValue",false,Argument_STRING);
current = entity_descriptor_map[Type::IfcMomentOfInertiaMeasure] = new IfcEntityDescriptor(Type::IfcMomentOfInertiaMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcDoseEquivalentMeasure] = new IfcEntityDescriptor(Type::IfcDoseEquivalentMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLogical] = new IfcEntityDescriptor(Type::IfcLogical,0);
current->add("wrappedValue",false,Argument_BOOL);
current = entity_descriptor_map[Type::IfcRatioMeasure] = new IfcEntityDescriptor(Type::IfcRatioMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcLuminousIntensityDistributionMeasure] = new IfcEntityDescriptor(Type::IfcLuminousIntensityDistributionMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcForceMeasure] = new IfcEntityDescriptor(Type::IfcForceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcElectricResistanceMeasure] = new IfcEntityDescriptor(Type::IfcElectricResistanceMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcWarpingConstantMeasure] = new IfcEntityDescriptor(Type::IfcWarpingConstantMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcShearModulusMeasure] = new IfcEntityDescriptor(Type::IfcShearModulusMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcPressureMeasure] = new IfcEntityDescriptor(Type::IfcPressureMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcBoolean] = new IfcEntityDescriptor(Type::IfcBoolean,0);
current->add("wrappedValue",false,Argument_BOOL);
current = entity_descriptor_map[Type::IfcSectionModulusMeasure] = new IfcEntityDescriptor(Type::IfcSectionModulusMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMassMeasure] = new IfcEntityDescriptor(Type::IfcMassMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMagneticFluxDensityMeasure] = new IfcEntityDescriptor(Type::IfcMagneticFluxDensityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcMoistureDiffusivityMeasure] = new IfcEntityDescriptor(Type::IfcMoistureDiffusivityMeasure,0);
current->add("wrappedValue",false,Argument_DOUBLE);
current = entity_descriptor_map[Type::IfcActorRole] = new IfcEntityDescriptor(Type::IfcActorRole,0);
current->add("Role",false,Argument_ENUMERATION);
current->add("UserDefinedRole",true,Argument_STRING);
+4 -448
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+20 -7
View File
@@ -353,7 +353,7 @@ TokenArgument::TokenArgument(const Token& t) {
}
EntityArgument::EntityArgument(Ifc2x3::Type::Enum ty, const Token& t) {
entity = new Ifc::IfcUntypedEntity(new Entity(0,t.first->file,t.second));
entity = new IfcUtil::IfcArgumentSelect(ty,new TokenArgument(t));
}
//
@@ -371,10 +371,11 @@ ArgumentList::ArgumentList(Tokens* t, std::vector<unsigned int>& ids) {
if ( TokenFunc::isDatatype(next) ) {
t->Next();
try {
Push ( new EntityArgument(Ifc2x3::Type::ALL,next) ); //Ifc2x3::Type::FromString(TokenFunc::asString(next)),t->Next()) );
Push ( new EntityArgument(Ifc2x3::Type::FromString(TokenFunc::asString(next)),t->Next()) );
} catch ( IfcException& e ) {
Logger::Message(Logger::LOG_ERROR,e.what());
}
t->Next();
} else {
Push ( new TokenArgument(next) );
}
@@ -492,7 +493,22 @@ EntityArgument::operator IfcEntities() const { throw IfcException("Argument is n
unsigned int EntityArgument::Size() const { return 1; }
ArgumentPtr EntityArgument::operator [] (unsigned int i) const { throw IfcException("Argument is not a list of arguments"); }
std::string EntityArgument::toString(bool upper) const {
return entity->entity->toString(upper);
ArgumentPtr arg = entity->wrappedValue();
IfcParse::TokenArgument* token_arg = dynamic_cast<IfcParse::TokenArgument*>(arg);
const bool is_string = TokenFunc::isString(token_arg->token);
std::string token_string = token_arg ? (is_string
? TokenFunc::asString(token_arg->token)
: TokenFunc::toString(token_arg->token))
: std::string();
std::string dt = Ifc2x3::Type::ToString(entity->type());
if ( upper ) {
for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p);
if (is_string) token_string = IfcWrite::IfcCharacterEncoder(token_string);
} else {
token_string.insert(token_string.begin(),'\'');
token_string.push_back('\'');
}
return dt + "(" + token_string + ")";
}
//return entity->entity->toString(); }
bool EntityArgument::isNull() const { return false; }
@@ -583,10 +599,7 @@ std::string Entity::toString(bool upper) {
if ( upper ) {
for (std::string::iterator p = dt.begin(); p != dt.end(); ++p ) *p = toupper(*p);
}
if (_id) {
ss << "#" << _id << "=";
}
ss << dt << args->toString(upper);
ss << "#" << _id << "=" << dt << args->toString(upper);
return ss.str();
}
+1 -1
View File
@@ -162,7 +162,7 @@ namespace IfcParse {
/// ===================== =====================
class EntityArgument : public Argument {
private:
Ifc::IfcUntypedEntity* entity;
IfcUtil::IfcArgumentSelect* entity;
public:
EntityArgument(Ifc2x3::Type::Enum ty, const Token& t);
~EntityArgument();
-6
View File
@@ -61,12 +61,6 @@ void Ifc::IfcUntypedEntity::invalid_argument(unsigned int i, const std::string&
const std::string arg_name = Ifc2x3::Type::GetAttributeName(_type,i);
throw IfcException(t + " is not a valid type for '" + arg_name + "'");
}
void Ifc::IfcUntypedEntity::setArgument(unsigned int i) {
bool is_optional = Ifc2x3::Type::GetAttributeOptional(_type, i);
if (is_optional) {
writable_entity()->setArgument(i);
} else invalid_argument(i,"NONE");
}
void Ifc::IfcUntypedEntity::setArgument(unsigned int i, int v) {
IfcUtil::ArgumentType arg_type = Ifc2x3::Type::GetAttributeType(_type,i);
if (arg_type == Argument_INT) {
-1
View File
@@ -27,7 +27,6 @@ namespace Ifc {
const char* getArgumentName(unsigned int i) const;
unsigned getArgumentIndex(const std::string& a) const;
void setArgument(unsigned int iz);
void setArgument(unsigned int i, int v);
void setArgument(unsigned int i, bool v);
void setArgument(unsigned int i, double v);
+2 -8
View File
@@ -37,12 +37,12 @@
%rename("get_argument_type") getArgumentType;
%rename("get_argument_name") getArgumentName;
%rename("get_argument_index") getArgumentIndex;
%rename("_set_argument") setArgument;
%rename("set_argument") setArgument;
%rename("__repr__") toString;
%rename("Entity") IfcUntypedEntity;
%typemap(out) IfcEntities {
const unsigned size = $1 ? $1->Size() : 0;
const unsigned size = $1->Size();
$result = PyList_New(size);
for (unsigned i = 0; i < size; ++i) {
PyObject *o = SWIG_NewPointerObj(SWIG_as_voidptr((*$1)[i]), SWIGTYPE_p_Ifc__IfcUntypedEntity, 0);
@@ -54,7 +54,6 @@
const Argument& arg = *($1.second);
const ArgumentType type = $1.first;
if (arg.isNull()) {
Py_INCREF(Py_None);
$result = Py_None;
} else {
switch(type) {
@@ -150,11 +149,6 @@
}
}
%extend Ifc::IfcUntypedEntity {
%pythoncode %{
set_argument = lambda self,x,y: self._set_argument(x) if y is None else self._set_argument(x,y)
%}
}
namespace std {
%template(Ints) vector<int>;
-3
View File
@@ -3,8 +3,6 @@
#include <map>
#include <fstream>
namespace Ifc { class IfcUntypedEntity; }
#include "../ifcparse/IfcUtil.h"
#include "../ifcparse/Ifc2x3.h"
@@ -28,7 +26,6 @@ namespace Ifc {
const char* getArgumentName(unsigned int i) const;
unsigned getArgumentIndex(const std::string& a) const;
void setArgument(unsigned int i);
void setArgument(unsigned int i, int v);
void setArgument(unsigned int i, bool v);
void setArgument(unsigned int i, double v);