@@ -28,7 +28,14 @@ class Mapping:
2828 'integer' : 'int' ,
2929 'real' : 'double' ,
3030 'number' : 'double' ,
31- 'string' : 'std::string'
31+ 'string' : 'std::string' ,
32+ 'binary' : 'boost::dynamic_bitset<>'
33+ }
34+
35+ supported_argument_types = {
36+ 'INT' , 'BOOL' , 'DOUBLE' , 'STRING' , 'BINARY' , 'ENUMERATION' , 'ENTITY_INSTANCE' ,
37+ 'AGGREGATE_OF_INT' , 'AGGREGATE_OF_DOUBLE' , 'AGGREGATE_OF_STRING' , 'AGGREGATE_OF_BINARY' , 'AGGREGATE_OF_ENTITY_INSTANCE' ,
38+ 'AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE'
3239 }
3340
3441 def __init__ (self , schema ):
@@ -77,24 +84,21 @@ def make_argument_type(self, attr):
7784 def _make_argument_type (type ):
7885 if type in self .express_to_cpp_typemapping :
7986 return self .express_to_cpp_typemapping .get (type , type ).split ('::' )[- 1 ].upper ()
80- elif self .schema .is_entity (type ):
81- return "ENTITY "
87+ elif self .schema .is_entity (type ) or isinstance ( type , nodes . SelectType ) :
88+ return "ENTITY_INSTANCE "
8289 elif self .schema .is_type (type ):
8390 return _make_argument_type (self .schema .types [type ].type .type )
8491 elif isinstance (type , nodes .BinaryType ):
85- return "UNKNOWN "
92+ return "BINARY "
8693 elif isinstance (type , nodes .EnumerationType ):
8794 return "ENUMERATION"
88- elif isinstance (type , nodes .SelectType ):
89- return "ENTITY"
9095 elif isinstance (type , nodes .AggregationType ):
9196 ty = _make_argument_type (type .type )
9297 if ty == "UNKNOWN" : return "UNKNOWN"
93- return "%s_LIST" % ty if ty . startswith ( "ENTITY" ) else ( "VECTOR_%s" % ty )
98+ return "AGGREGATE_OF_" + ty
9499 else : raise ValueError
95- supported = {'INT' , 'BOOL' , 'DOUBLE' , 'STRING' , 'VECTOR_INT' , 'VECTOR_DOUBLE' , 'VECTOR_STRING' , 'ENTITY' , 'ENTITY_LIST' , 'ENTITY_LIST_LIST' , 'ENUMERATION' }
96100 ty = _make_argument_type (attr .type if hasattr (attr , 'type' ) else attr )
97- if ty not in supported : ty = 'UNKNOWN'
101+ if ty not in self . supported_argument_types : ty = 'UNKNOWN'
98102 return "IfcUtil::Argument_%s" % ty
99103
100104 def get_type_dep (self , type ):
@@ -104,7 +108,6 @@ def get_type_dep(self, type):
104108 return self .get_type_dep (type .type )
105109
106110 def get_parameter_type (self , attr , allow_optional , allow_entities , allow_pointer = True ):
107-
108111 attr_type = self .flatten_type (attr .type )
109112 type_str = self .express_to_cpp_typemapping .get (str (attr_type ), attr_type )
110113
@@ -115,7 +118,7 @@ def get_parameter_type(self, attr, allow_optional, allow_entities, allow_pointer
115118 elif isinstance (type_str , nodes .AggregationType ):
116119 is_nested_list = isinstance (attr_type .type , nodes .AggregationType )
117120 ty = self .get_parameter_type (attr_type .type if is_nested_list else attr_type , False , allow_entities , False )
118- if True and self .schema .is_select (attr_type .type ):
121+ if self .schema .is_select (attr_type .type ):
119122 type_str = templates .untyped_list
120123 elif self .schema .is_simpletype (ty ) or ty in self .express_to_cpp_typemapping .values ():
121124 type_str = templates .array_type % {
@@ -151,7 +154,7 @@ def derived_in_supertype(self, t):
151154 return c + ([str (s ) for s in t .derive .elements ] if t .derive else [])
152155
153156 def list_instance_type (self , attr ):
154- f = lambda v : 'IfcUtil::IfcBaseClass' if self .schema .is_select (v ) else v
157+ f = lambda v : 'IfcUtil::IfcBaseClass' if self .schema .is_select (v ) else str ( v )
155158 if self .is_array (attr .type ):
156159 if not isinstance (attr .type , str ) and self .is_array (attr .type .type ):
157160 if isinstance (attr .type .type , str ):
0 commit comments