Merge v0.7.0 -- src\ifcopenshell-python\ifcopenshell\express

This commit is contained in:
Thomas Krijnen
2023-10-17 12:12:37 +02:00
parent d52f12973a
commit 6302be6bfd
18 changed files with 14296 additions and 201 deletions
@@ -85,7 +85,6 @@ class Implementation(codegen.Base):
def find_template(arg):
simple = mapping.schema.is_simpletype(arg["list_instance_type"])
select = arg["list_instance_type"] == "IfcUtil::IfcBaseClass"
express = (
mapping.flatten_type_string(arg["list_instance_type"]) in mapping.express_to_cpp_typemapping
)
@@ -93,7 +92,7 @@ class Implementation(codegen.Base):
return templates.get_attr_stmt_enum
elif arg["is_nested"] and arg["is_templated_list"]:
return templates.get_attr_stmt_nested_array
elif arg["is_templated_list"] and not (select or simple or express):
elif arg["is_templated_list"] and not (simple or express):
return templates.get_attr_stmt_array
elif arg["non_optional_type"].endswith("*"):
return templates.get_attr_stmt_entity
@@ -179,9 +179,13 @@ class Mapping:
# We do not use pointers in aggregate_of<T>. aggregate_of has member vector<T*>
ty = ty.replace("*", "")
if self.schema.is_select(attr_type.type):
type_str = templates.untyped_list
elif self.schema.is_simpletype(ty) or str(ty) in self.express_to_cpp_typemapping.values():
# https://github.com/IfcOpenShell/IfcOpenShell/issues/2805
# This is no longer applicable, we do support statically typed select types as aggregates
#
# if self.schema.is_select(attr_type.type):
# type_str = templates.untyped_list
if self.schema.is_simpletype(ty) or str(ty) in self.express_to_cpp_typemapping.values():
tmpl = templates.nested_array_type if is_nested_list else templates.array_type
bounds = (attr_type.bounds.lower, attr_type.bounds.upper) if attr_type.bounds else (-1, -1)
type_str = tmpl % {"instance_type": ty, "lower": bounds[0], "upper": bounds[1]}
@@ -220,9 +224,9 @@ class Mapping:
isinstance(v, nodes.SimpleType) and isinstance(v.type, nodes.StringType)
):
return "string"
if self.schema.is_select(v):
return "IfcUtil::IfcBaseClass"
elif str(v) in self.schema.types or str(v) in self.schema.entities:
# if self.schema.is_select(v):
# return "IfcUtil::IfcBaseClass"
if str(v) in self.schema.types or str(v) in self.schema.entities:
return "::%s::%s" % (self.schema.name.capitalize(), v)
else:
return str(v)
@@ -420,6 +420,15 @@ def process_expression(context):
exclude=[context.rel_op_extended],
)
else:
if len(context.simple_expression.branches()) == 2 and str(context.rel_op_extended) == 'in':
# IfcBlobTexture
try:
is_literal_str_list = set(map(type, ast.literal_eval(str(context.simple_expression.branches()[1])))) == {str}
except:
is_literal_str_list = False
if is_literal_str_list:
a, b = map(str, context.simple_expression.branches())
return f"{a}.lower() {str(context.rel_op_extended)} {b}"
return concat(context.rel_op_extended, context.simple_expression)
elif context.multiplication_like_op:
if str(context.multiplication_like_op.branches()[0]) == "||":
@@ -444,6 +453,7 @@ def process_expression(context):
break_points[-1].append(len(args))
# @todo don't depend on registered schema
S = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema.name)
entity = S.declaration_by_name(typename)
entity_attributes = entity.attributes()
@@ -806,7 +816,26 @@ if __name__ == "__main__":
import subprocess
schema = ifcopenshell.express.express_parser.parse(sys.argv[1]).schema
ofn = os.path.join(os.path.dirname(__file__), "rules", f"{schema.name}.py")
try:
ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema.name)
except:
# @nb note the difference here between:
#
# - ifcopenshell.express.express_parser.parse
# - ifcopenshell.express.parse.parse
#
# First generates a pyparsing AST
#
# Second populates a latebound schema
# that can be registered in C++.
builder = ifcopenshell.express.parse(sys.argv[1])
ifcopenshell.register_schema(builder)
try:
ofn = sys.argv[2]
except IndexError as e:
ofn = os.path.join(os.path.dirname(__file__), "rules", f"{schema.name}.py")
output = io.StringIO()
print("import ifcopenshell", file=output, sep="\n")
@@ -1025,5 +1054,8 @@ INDETERMINATE = indeterminate_type()
trsf.assign_parent_refs(tree)
trsf.visit(tree)
with open(ofn, "w") as f:
f.write(ast.unparse(tree))
if ofn == "-":
print(ast.unparse(tree))
else:
with open(ofn, "w") as f:
f.write(ast.unparse(tree))
@@ -9,7 +9,7 @@ from codegen import indent
def reverse_compile(s):
return re.sub(
"\s*\-\s*EXPRESS_ONE_BASED_INDEXING",
r"\s*\-\s*EXPRESS_ONE_BASED_INDEXING",
"",
re.sub(
", )?+.(, INDETERMINATE)\\"[::-1],
@@ -81,14 +81,29 @@ def run(f, logger):
orig = ifcopenshell.settings.unpack_non_aggregate_inverses
ifcopenshell.settings.unpack_non_aggregate_inverses = True
fn = os.path.join(os.path.dirname(__file__), "rules", f"{f.schema}.py")
source = open(fn, "r").read()
fn = os.path.join(os.path.dirname(__file__), "rules", f"{f.schema_identifier}.py")
try:
source = open(fn, "r").read()
except FileNotFoundError as e:
import sys
import time
import subprocess
current_dir_files = {fn.lower(): fn for fn in os.listdir('.')}
schema_name = str(f.schema_identifier).split(' ')[-1].lower()
schema_path = current_dir_files.get(schema_name + '.exp')
fn = schema_path[:-4] + '.py'
if not os.path.exists(fn):
subprocess.run([sys.executable, "-m", "ifcopenshell.express.rule_compiler", schema_path, fn], check=True)
time.sleep(1.)
source = open(fn, "r").read()
a = ast.parse(source)
assertion.rewrite.rewrite_asserts(mod=a, source=source)
cd = compile(a, f"{f.schema}.py", "exec")
cd = compile(a, f"{f.schema_identifier}.py", "exec")
scope = {}
exec(cd, scope)
S = ifcopenshell.ifcopenshell_wrapper.schema_by_name(f.schema)
S = ifcopenshell.ifcopenshell_wrapper.schema_by_name(f.schema_identifier)
rules = list(filter(lambda x: hasattr(x, "SCOPE"), scope.values()))
@@ -182,10 +197,14 @@ def run(f, logger):
type = type.declared_type()
if isinstance(value, (list, tuple)):
assert isinstance(type, ifcopenshell.ifcopenshell_wrapper.aggregation_type)
ty = type.type_of_element()
for v in value:
check(v, ty, instance=inst)
if isinstance(type, ifcopenshell.ifcopenshell_wrapper.aggregation_type):
ty = type.type_of_element()
for v in value:
check(v, ty, instance=inst)
else:
# Let's hope a schema validation error was reported for this case
pass
elif isinstance(value, ifcopenshell.entity_instance):
if isinstance(
S.declaration_by_name(value.is_a()),
@@ -198,7 +217,14 @@ def run(f, logger):
check(value[0], S.declaration_by_name(value.is_a()), instance=inst)
for inst in f:
values = list(inst)
try:
values = list(inst)
except Exception as e:
if hasattr(logger, "set_state"):
logger.error(str(e))
else:
logger.error("For instance:\n %s\n%s", inst, e)
continue
entity = S.declaration_by_name(inst.is_a())
attrs = entity.all_attributes()
for i, (attr, val, is_derived) in enumerate(
@@ -3579,7 +3579,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCompoundPlaneAngleMeasure_WR1:
SCOPE = 'type'
@@ -3642,7 +3642,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -3651,7 +3651,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -3660,7 +3660,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -3768,7 +3768,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -3777,7 +3777,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -3786,7 +3786,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class Ifc2DCompositeCurve_WR1:
SCOPE = 'entity'
@@ -4137,7 +4137,7 @@ class IfcBlobTexture_WR11:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBoilerType_WR1:
SCOPE = 'entity'
@@ -4736,7 +4736,7 @@ class IfcDimensionCalloutRelationship_WR11:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['primary', 'secondary']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['primary', 'secondary']) is not False
class IfcDimensionCalloutRelationship_WR12:
SCOPE = 'entity'
@@ -4819,7 +4819,7 @@ class IfcDimensionPair_WR11:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['chained', 'parallel']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['chained', 'parallel']) is not False
class IfcDimensionPair_WR12:
SCOPE = 'entity'
@@ -4934,7 +4934,7 @@ class IfcDraughtingPreDefinedColour_WR31:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_WR31:
SCOPE = 'entity'
@@ -4943,7 +4943,7 @@ class IfcDraughtingPreDefinedCurveFont_WR31:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDraughtingPreDefinedTextFont_WR31:
SCOPE = 'entity'
@@ -4952,7 +4952,7 @@ class IfcDraughtingPreDefinedTextFont_WR31:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['iso3098-1fonta', 'iso3098-1fontb']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['iso3098-1fonta', 'iso3098-1fontb']) is not False
class IfcDuctFittingType_WR2:
SCOPE = 'entity'
@@ -5782,7 +5782,7 @@ class IfcPreDefinedDimensionSymbol_WR31:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['arclength', 'conicaltaper', 'counterbore', 'countersink', 'depth', 'diameter', 'plusminus', 'radius', 'slope', 'sphericaldiameter', 'sphericalradius', 'square']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['arclength', 'conicaltaper', 'counterbore', 'countersink', 'depth', 'diameter', 'plusminus', 'radius', 'slope', 'sphericaldiameter', 'sphericalradius', 'square']) is not False
class IfcPreDefinedPointMarkerSymbol_WR31:
SCOPE = 'entity'
@@ -5791,7 +5791,7 @@ class IfcPreDefinedPointMarkerSymbol_WR31:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['asterisk', 'circle', 'dot', 'plus', 'square', 'triangle', 'x']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['asterisk', 'circle', 'dot', 'plus', 'square', 'triangle', 'x']) is not False
class IfcPreDefinedTerminatorSymbol_WR31:
SCOPE = 'entity'
@@ -5800,7 +5800,7 @@ class IfcPreDefinedTerminatorSymbol_WR31:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['blankedarrow', 'blankedbox', 'blankeddot', 'dimensionorigin', 'filledarrow', 'filledbox', 'filleddot', 'integralsymbol', 'openarrow', 'slash', 'unfilledarrow']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['blankedarrow', 'blankedbox', 'blankeddot', 'dimensionorigin', 'filledarrow', 'filledbox', 'filleddot', 'integralsymbol', 'openarrow', 'slash', 'unfilledarrow']) is not False
class IfcProcedure_WR1:
SCOPE = 'entity'
@@ -6786,7 +6786,7 @@ class IfcStructuredDimensionCallout_WR31:
@staticmethod
def __call__(self):
contents = getattr(self, 'Contents', INDETERMINATE)
assert (sizeof([ato for ato in [con for con in getattr(self, 'contents', INDETERMINATE) if 'ifc2x3.ifcannotationtextoccurrence' in typeof(con)] if not getattr(ato, 'Name', INDETERMINATE) in ['dimensionvalue', 'tolerancevalue', 'unittext', 'prefixtext', 'suffixtext']]) == 0) is not False
assert (sizeof([ato for ato in [con for con in getattr(self, 'contents', INDETERMINATE) if 'ifc2x3.ifcannotationtextoccurrence' in typeof(con)] if not getattr(getattr(ato, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['dimensionvalue', 'tolerancevalue', 'unittext', 'prefixtext', 'suffixtext']]) == 0) is not False
class IfcStyledItem_WR11:
SCOPE = 'entity'
@@ -4313,7 +4313,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -4394,7 +4394,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -4403,7 +4403,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -4412,7 +4412,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -4511,7 +4511,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -4520,7 +4520,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -4529,7 +4529,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -5178,7 +5178,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -6580,7 +6580,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -6589,7 +6589,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -4404,7 +4404,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -4485,7 +4485,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -4494,7 +4494,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -4503,7 +4503,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -4602,7 +4602,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -4611,7 +4611,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -4620,7 +4620,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -5269,7 +5269,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -6671,7 +6671,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -6680,7 +6680,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -4555,7 +4555,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -4636,7 +4636,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -4645,7 +4645,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -4654,7 +4654,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -4753,7 +4753,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -4762,7 +4762,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -4771,7 +4771,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -5450,7 +5450,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -6892,7 +6892,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -6901,7 +6901,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -5180,7 +5180,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5261,7 +5261,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5270,7 +5270,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5279,7 +5279,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5378,7 +5378,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5387,7 +5387,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5396,7 +5396,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6123,7 +6123,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBoiler_CorrectPredefinedType:
SCOPE = 'entity'
@@ -7712,7 +7712,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7721,7 +7721,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -5130,7 +5130,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5211,7 +5211,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5220,7 +5220,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5229,7 +5229,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5328,7 +5328,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5337,7 +5337,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5346,7 +5346,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6073,7 +6073,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBoiler_CorrectPredefinedType:
SCOPE = 'entity'
@@ -7661,7 +7661,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7670,7 +7670,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
File diff suppressed because it is too large Load Diff
@@ -5115,7 +5115,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5196,7 +5196,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5205,7 +5205,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5214,7 +5214,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5313,7 +5313,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5322,7 +5322,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5331,7 +5331,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6010,7 +6010,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -7564,7 +7564,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7573,7 +7573,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -5156,7 +5156,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5237,7 +5237,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5246,7 +5246,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5255,7 +5255,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5354,7 +5354,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5363,7 +5363,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5372,7 +5372,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6098,7 +6098,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -7652,7 +7652,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7661,7 +7661,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -5145,7 +5145,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5226,7 +5226,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5235,7 +5235,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5244,7 +5244,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5343,7 +5343,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5352,7 +5352,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5361,7 +5361,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6087,7 +6087,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -7685,7 +7685,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7694,7 +7694,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -5161,7 +5161,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5242,7 +5242,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5251,7 +5251,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5260,7 +5260,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5359,7 +5359,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5368,7 +5368,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5377,7 +5377,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6103,7 +6103,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBlobTexture_RasterCodeByteStream:
SCOPE = 'entity'
@@ -7701,7 +7701,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7710,7 +7710,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -5118,7 +5118,7 @@ class IfcBoxAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['top-left', 'top-middle', 'top-right', 'middle-left', 'center', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right']) is not False
class IfcCardinalPointReference_GreaterThanZero:
SCOPE = 'type'
@@ -5199,7 +5199,7 @@ class IfcFontStyle_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'italic', 'oblique']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'italic', 'oblique']) is not False
class IfcFontVariant_WR1:
SCOPE = 'type'
@@ -5208,7 +5208,7 @@ class IfcFontVariant_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps']) is not False
class IfcFontWeight_WR1:
SCOPE = 'type'
@@ -5217,7 +5217,7 @@ class IfcFontWeight_WR1:
@staticmethod
def __call__(self):
assert (self in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['normal', 'small-caps', '100', '200', '300', '400', '500', '600', '700', '800', '900']) is not False
class IfcHeatingValueMeasure_WR1:
SCOPE = 'type'
@@ -5316,7 +5316,7 @@ class IfcTextAlignment_WR1:
@staticmethod
def __call__(self):
assert (self in ['left', 'right', 'center', 'justify']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['left', 'right', 'center', 'justify']) is not False
class IfcTextDecoration_WR1:
SCOPE = 'type'
@@ -5325,7 +5325,7 @@ class IfcTextDecoration_WR1:
@staticmethod
def __call__(self):
assert (self in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['none', 'underline', 'overline', 'line-through', 'blink']) is not False
class IfcTextTransformation_WR1:
SCOPE = 'type'
@@ -5334,7 +5334,7 @@ class IfcTextTransformation_WR1:
@staticmethod
def __call__(self):
assert (self in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
assert (getattr(self, 'lower', INDETERMINATE)() in ['capitalize', 'uppercase', 'lowercase', 'none']) is not False
class IfcActorRole_WR1:
SCOPE = 'entity'
@@ -6061,7 +6061,7 @@ class IfcBlobTexture_SupportedRasterFormat:
@staticmethod
def __call__(self):
assert (getattr(self, 'RasterFormat', INDETERMINATE) in ['bmp', 'jpg', 'gif', 'png']) is not False
assert (getattr(getattr(self, 'RasterFormat', INDETERMINATE), 'lower', INDETERMINATE)() in ['bmp', 'jpg', 'gif', 'png']) is not False
class IfcBoiler_CorrectPredefinedType:
SCOPE = 'entity'
@@ -7638,7 +7638,7 @@ class IfcDraughtingPreDefinedColour_PreDefinedColourNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', 'white', 'bylayer']) is not False
class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
SCOPE = 'entity'
@@ -7647,7 +7647,7 @@ class IfcDraughtingPreDefinedCurveFont_PreDefinedCurveFontNames:
@staticmethod
def __call__(self):
assert (getattr(self, 'Name', INDETERMINATE) in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
assert (getattr(getattr(self, 'Name', INDETERMINATE), 'lower', INDETERMINATE)() in ['continuous', 'chain', 'chaindoubledash', 'dashed', 'dotted', 'bylayer']) is not False
class IfcDuctFitting_CorrectPredefinedType:
SCOPE = 'entity'
@@ -84,7 +84,7 @@ class LateBoundSchemaInstantiator:
for attr_name, decl_type, optional in attribute_definitions:
attributes.append(w.attribute(attr_name, decl_type, optional))
self.declarations[str(name)].set_attributes(attributes, is_derived)
self.cache.append(attributes)
self.cache.extend(attributes)
def inverse_attributes(self, name, inv_attrs):
attributes = []
@@ -100,6 +100,7 @@ class LateBoundSchemaInstantiator:
en.attributes()[attribute_entity_index],
)
)
self.cache.extend(attributes)
self.declarations[str(name)].set_inverse_attributes(attributes)
def entity_subtypes(self, name, tys):
@@ -110,10 +111,13 @@ class LateBoundSchemaInstantiator:
override_schema_name or self.schema_name, list(self.declarations.values()), None
)
def disown(self):
for elem in self.cache + list(self.declarations.values()):
elem.this.disown()
class EarlyBoundCodeWriter:
def __init__(self, schema_name):
self.strings = []
self.schema_name = schema_name
self.schema_name_title = schema_name.capitalize()
@@ -127,14 +131,6 @@ class EarlyBoundCodeWriter:
]
self.names = []
def make_string(self, s):
try:
i = self.strings.index(s)
except ValueError:
self.strings.append(s)
i = len(self.strings) - 1
return "strings[%d]" % i
def aggregation_type(self, aggr_type, bound1, bound2, decl_type):
return (
@@ -157,9 +153,6 @@ class EarlyBoundCodeWriter:
self.names.sort(key=str.lower)
self.statements.append("{factory_placeholder}")
self.statements.append("using namespace std::string_literals;")
self.statements.append("{strings_placeholder}")
self.statements.append(
"""
@@ -176,109 +169,107 @@ __attribute__((optnone))
self.statements.append("IfcParse::schema_definition* %s_populate_schema() {" % self.schema_name)
def typedef(self, name, declared_type):
name_string = self.make_string(name)
schema_name = self.schema_name
index_in_schema = self.names.index(name)
self.statements.append(
' %(schema_name)s_%(name)s_type = new type_declaration(%(name_string)s, %(index_in_schema)d, %(declared_type)s);'
' %(schema_name)s_%(name)s_type = new type_declaration("%(name)s", %(index_in_schema)d, %(declared_type)s);'
% locals()
)
def enumeration(self, name, enum):
schema_name = self.schema_name
index_in_schema = self.names.index(name)
name_string = self.make_string(name)
# @tfk we don't sort for correspondence with header file
# values = sorted(enum.values)
values = enum.values
self.statements.append(" {")
self.statements.append(" std::vector<std::string> items; items.reserve(%d);" % len(enum.values))
self.statements.extend(map(lambda v: ' items.push_back("%s");' % v, sorted(enum.values)))
self.statements.append(
' %(schema_name)s_%(name)s_type = new enumeration_type(%(name_string)s, %(index_in_schema)d, {'
' %(schema_name)s_%(name)s_type = new enumeration_type("%(name)s", %(index_in_schema)d, items);'
% locals()
)
self.statements.extend(map(lambda v: ' %s%s' % (self.make_string(v), '' if v == values[-1] else ','), values))
self.statements.append(' });')
self.statements.append(" }")
def entity(self, name, type):
schema_name = self.schema_name
index_in_schema = self.names.index(name)
name_string = self.make_string(name)
supertype = "0" if len(type.supertypes) == 0 else "%s_%s_type" % (self.schema_name, type.supertypes[0])
is_abstract = "true" if type.abstract else "false"
self.statements.append(
' %(schema_name)s_%(name)s_type = new entity(%(name_string)s, %(is_abstract)s, %(index_in_schema)d, %(supertype)s);'
' %(schema_name)s_%(name)s_type = new entity("%(name)s", %(is_abstract)s, %(index_in_schema)d, %(supertype)s);'
% locals()
)
def select(self, name, type):
schema_name = self.schema_name
index_in_schema = self.names.index(name)
name_string = self.make_string(name)
values = sorted(map(str, type.values))
self.statements.append(" {")
self.statements.append(" std::vector<const declaration*> items; items.reserve(%d);" % len(type.values))
self.statements.extend(
map(lambda v: " items.push_back(%s_%s_type);" % (self.schema_name, v), sorted(map(str, type.values)))
)
self.statements.append(
' %(schema_name)s_%(name)s_type = new select_type(%(name_string)s, %(index_in_schema)d, {'
' %(schema_name)s_%(name)s_type = new select_type("%(name)s", %(index_in_schema)d, items);'
% locals()
)
self.statements.extend(
map(lambda v: " %s_%s_type%s" % (self.schema_name, v, '' if v == values[-1] else ','), values)
)
self.statements.append(" });")
self.statements.append(" }")
def entity_attributes(self, name, attribute_definitions, is_derived):
schema_name = self.schema_name
self.statements.append(" %(schema_name)s_%(name)s_type->set_attributes({" % locals())
self.statements.append(" {")
self.statements.append(
" std::vector<const attribute*> attributes; attributes.reserve(%d);" % len(attribute_definitions)
)
for attr_name, decl_type, optional in attribute_definitions:
name_string = self.make_string(attr_name)
optional_cpp = str(optional).lower()
tail = '' if attr_name == attribute_definitions[-1][0] else ','
self.statements.append(
' new attribute(%(name_string)s, %(decl_type)s, %(optional_cpp)s)%(tail)s'
' attributes.push_back(new attribute("%(attr_name)s", %(decl_type)s, %(optional_cpp)s));'
% locals()
)
self.statements.append(" },{")
self.statements.append(" std::vector<bool> derived; derived.reserve(%d);" % len(is_derived))
self.statements.append(
" " + " ".join(map(lambda i, b: "%s%s" % (str(b).lower(), '' if i == len(is_derived) - 1 else ','), range(len(is_derived)), is_derived))
" " + " ".join(map(lambda b: "derived.push_back(%s);" % str(b).lower(), is_derived))
)
self.statements.append(" });")
self.statements.append(" %(schema_name)s_%(name)s_type->set_attributes(attributes, derived);" % locals())
self.statements.append(" }")
def inverse_attributes(self, name, inv_attrs):
schema_name = self.schema_name
self.statements.append(" %(schema_name)s_%(name)s_type->set_inverse_attributes({" % locals())
self.statements.append(" {")
self.statements.append(
" std::vector<const inverse_attribute*> attributes; attributes.reserve(%d);" % len(inv_attrs)
)
for attr_name, aggr_type, bound1, bound2, entity_ref, attribute_entity, attribute_entity_index in inv_attrs:
name_string = self.make_string(attr_name)
tail = '' if attr_name == inv_attrs[-1][0] else ','
self.statements.append(
' new inverse_attribute(%(name_string)s, inverse_attribute::%(aggr_type)s_type, %(bound1)d, %(bound2)d, %(schema_name)s_%(entity_ref)s_type, %(schema_name)s_%(attribute_entity)s_type->attributes()[%(attribute_entity_index)d])%(tail)s'
' attributes.push_back(new inverse_attribute("%(attr_name)s", inverse_attribute::%(aggr_type)s_type, %(bound1)d, %(bound2)d, %(schema_name)s_%(entity_ref)s_type, %(schema_name)s_%(attribute_entity)s_type->attributes()[%(attribute_entity_index)d]));'
% locals()
)
self.statements.append(" });")
self.statements.append(" %(schema_name)s_%(name)s_type->set_inverse_attributes(attributes);" % locals())
self.statements.append(" }")
def entity_subtypes(self, name, tys):
schema_name = self.schema_name
self.statements.append(" %(schema_name)s_%(name)s_type->set_subtypes({" % locals())
self.statements.append(" {")
self.statements.append(" std::vector<const entity*> defs; defs.reserve(%d);" % len(tys))
self.statements.append(
(" " + "".join(map(lambda t: ("%%(schema_name)s_%s_type%s" % (t, '' if t == tys[-1] else ',')), tys))) % locals()
)
self.statements.append(" });")
(" " + "".join(map(lambda t: ("defs.push_back(%%(schema_name)s_%s_type);" % t), tys))) % locals()
)
self.statements.append(" %(schema_name)s_%(name)s_type->set_subtypes(defs);" % locals())
self.statements.append(" }")
def finalize(self, can_be_instantiated_set):
schema_name = self.schema_name
schema_name_string = self.make_string(self.schema_name)
schema_name_title = self.schema_name.capitalize()
num_declarations = len(self.names)
self.statements.append("")
self.statements.append(
" std::vector<const declaration*> declarations= {"
" std::vector<const declaration*> declarations; declarations.reserve(%(num_declarations)d);" % locals()
)
for type_name in self.names:
tail = '' if type_name == self.names[-1] else ','
self.statements.append(" %(schema_name)s_%(type_name)s_type%(tail)s" % locals())
self.statements.append(" };")
self.statements.append(" declarations.push_back(%(schema_name)s_%(type_name)s_type);" % locals())
self.statements.append(
' return new schema_definition(%(schema_name_string)s, declarations, new %(schema_name)s_instance_factory());'
' return new schema_definition("%(schema_name)s", declarations, new %(schema_name)s_instance_factory());'
% locals()
)
@@ -345,12 +336,6 @@ class %(schema_name)s_instance_factory : public IfcParse::instance_factory {
% locals()
)
strings_list = ",\n".join('"%s"s' % s for s in self.strings)
self.statements[self.statements.index("{strings_placeholder}")] = (
"static std::string strings[] = {%s};" % strings_list
)
def __str__(self):
return "\n".join(self.statements)
@@ -142,6 +142,7 @@ select = """%(documentation)s
class IFC_PARSE_API %(name)s : public virtual IfcUtil::IfcBaseInterface {
public:
static const IfcParse::select_type& Class();
typedef aggregate_of< %(name)s > list;
};
"""
@@ -199,11 +200,14 @@ const IfcParse::enumeration_type& %(schema_name)s::%(name)s::Class() { return *%
}
const char* %(schema_name)s::%(name)s::ToString(Value v) {
return %(schema_name_upper)s_%(name)s_type->lookup_enum_value((size_t) v);
if ( v < 0 || v >= %(max_id)d ) throw IfcException("Unable to find keyword in schema");
const char* names[] = { %(values)s };
return names[v];
}
%(schema_name)s::%(name)s::Value %(schema_name)s::%(name)s::FromString(const std::string& s) {
return (%(schema_name)s::%(name)s::Value) %(schema_name_upper)s_%(name)s_type->lookup_enum_offset(s);
%(from_string_statements)s
throw IfcException("Unable to find keyword in schema: " + s);
}
%(schema_name)s::%(name)s::operator %(schema_name)s::%(name)s::Value() const {