Skip to content

Commit 3d6b330

Browse files
committed
Reintroduce binary type in express parser
1 parent 37d4e9b commit 3d6b330

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/ifcexpressparser/bootstrap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def find_keywords(expr, li = None):
114114
'aggregation_types' : "lambda t: AggregationType(t)",
115115
'general_aggregation_types' : "lambda t: AggregationType(t)",
116116
'select_type' : "lambda t: SelectType(t)",
117+
'binary_type' : "lambda t: BinaryType(t)",
117118
'subtype_declaration' : "lambda t: SubtypeExpression(t)",
118119
'derive_clause' : "lambda t: AttributeList('derive', t)",
119120
'derived_attr' : "lambda t: DerivedAttribute(t)",

src/ifcexpressparser/mapping.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def is_array(self, type):
7777
def make_argument_entity(self, attr):
7878
type = attr.type if hasattr(attr, 'type') else attr
7979
while isinstance(type, nodes.AggregationType): type = type.type
80-
if type in self.express_to_cpp_typemapping: return "Type::UNDEFINED"
80+
if str(type) in self.express_to_cpp_typemapping: return "Type::UNDEFINED"
8181
else: return "Type::%s" % type
8282

8383
def make_argument_type(self, attr):
@@ -88,6 +88,8 @@ def _make_argument_type(type):
8888
return "ENTITY_INSTANCE"
8989
elif self.schema.is_type(type):
9090
return _make_argument_type(self.schema.types[type].type.type)
91+
elif isinstance(type, nodes.BinaryType):
92+
return "BINARY"
9193
elif isinstance(type, nodes.EnumerationType):
9294
return "ENUMERATION"
9395
elif isinstance(type, nodes.AggregationType):

src/ifcexpressparser/nodes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ def __repr__(self):
145145
return str(self.name)
146146

147147

148+
class BinaryType(Node):
149+
def init(self):
150+
pass
151+
def __repr__(self):
152+
return "binary"
153+
154+
148155
class BoundSpecification(Node):
149156
lower = property(lambda self: self.tokens[1])
150157
upper = property(lambda self: self.tokens[3])

src/ifcparse/Ifc4.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7366,8 +7366,8 @@ bool IfcPropertySetDefinitionSet::is(Type::Enum v) const { return v == IfcProper
73667366
Type::Enum IfcPropertySetDefinitionSet::type() const { return Type::IfcPropertySetDefinitionSet; }
73677367
Type::Enum IfcPropertySetDefinitionSet::Class() { return Type::IfcPropertySetDefinitionSet; }
73687368
IfcPropertySetDefinitionSet::IfcPropertySetDefinitionSet(IfcAbstractEntity* e) { entity = e; }
7369-
IfcPropertySetDefinitionSet::IfcPropertySetDefinitionSet(IfcTemplatedEntityList< IfcPropertySetDefinition >::ptr v) { IfcWritableEntity* e = new IfcWritableEntity(Type::IfcPropertySetDefinitionSet); e->setArgument(0, v); entity = e; }
7370-
IfcPropertySetDefinitionSet::operator IfcTemplatedEntityList< IfcPropertySetDefinition >::ptr() const { return *entity->getArgument(0); }
7369+
IfcPropertySetDefinitionSet::IfcPropertySetDefinitionSet(IfcTemplatedEntityList< IfcPropertySetDefinition >::ptr v) { IfcWritableEntity* e = new IfcWritableEntity(Type::IfcPropertySetDefinitionSet); e->setArgument(0, v->generalize()); entity = e; }
7370+
IfcPropertySetDefinitionSet::operator IfcTemplatedEntityList< IfcPropertySetDefinition >::ptr() const { IfcEntityList::ptr es = *entity->getArgument(0); return es->as<IfcPropertySetDefinition>(); }
73717371

73727372
// Function implementations for IfcRadioActivityMeasure
73737373
IfcUtil::ArgumentType IfcRadioActivityMeasure::getArgumentType(unsigned int i) const { if (i == 0) { return IfcUtil::Argument_DOUBLE; } else { throw IfcParse::IfcException("argument out of range"); } }

0 commit comments

Comments
 (0)