|
60 | 60 |
|
61 | 61 | namespace Type { |
62 | 62 | typedef enum { |
63 | | - %(types)s, ALL |
| 63 | + %(types)s, UNDEFINED |
64 | 64 | } Enum; |
65 | 65 | Enum Parent(Enum v); |
66 | 66 | Enum FromString(const std::string& s); |
|
88 | 88 | int GetAttributeCount(Enum t); |
89 | 89 | int GetAttributeIndex(Enum t, const std::string& a); |
90 | 90 | IfcUtil::ArgumentType GetAttributeType(Enum t, unsigned char a); |
| 91 | + Enum GetAttributeEntity(Enum t, unsigned char a); |
91 | 92 | const std::string& GetAttributeName(Enum t, unsigned char a); |
92 | 93 | bool GetAttributeOptional(Enum t, unsigned char a); |
93 | 94 | bool GetAttributeDerived(Enum t, unsigned char a); |
94 | 95 | std::pair<const char*, int> GetEnumerationIndex(Enum t, const std::string& a); |
95 | 96 | std::pair<Enum, unsigned> GetInverseAttribute(Enum t, const std::string& a); |
96 | | - Enum GetAttributeEnumerationClass(Enum t, unsigned char a); |
97 | 97 | void PopulateDerivedFields(IfcWrite::IfcWritableEntity* e); |
98 | 98 | }} |
99 | 99 |
|
|
211 | 211 | else return i->second->getArgumentType(a); |
212 | 212 | } |
213 | 213 |
|
| 214 | +Type::Enum Type::GetAttributeEntity(Enum t, unsigned char a) { |
| 215 | + if (entity_descriptor_map.empty()) ::InitDescriptorMap(); |
| 216 | + std::map<Type::Enum,IfcEntityDescriptor*>::const_iterator i = entity_descriptor_map.find(t); |
| 217 | + if ( i == entity_descriptor_map.end() ) throw IfcException("Type not found"); |
| 218 | + else return i->second->getArgumentEntity(a); |
| 219 | +} |
| 220 | +
|
214 | 221 | const std::string& Type::GetAttributeName(Enum t, unsigned char a) { |
215 | 222 | if (entity_descriptor_map.empty()) ::InitDescriptorMap(); |
216 | 223 | std::map<Type::Enum,IfcEntityDescriptor*>::const_iterator i = entity_descriptor_map.find(t); |
|
250 | 257 | throw IfcException("Attribute not found"); |
251 | 258 | } |
252 | 259 |
|
253 | | -Type::Enum Type::GetAttributeEnumerationClass(Enum t, unsigned char a) { |
254 | | - if (entity_descriptor_map.empty()) ::InitDescriptorMap(); |
255 | | - std::map<Type::Enum,IfcEntityDescriptor*>::const_iterator i = entity_descriptor_map.find(t); |
256 | | - if ( i == entity_descriptor_map.end() ) throw IfcException("Type not found"); |
257 | | - else { |
258 | | - Type::Enum t = i->second->getArgumentEnumerationClass(a); |
259 | | - if ( t == Type::ALL ) throw IfcException("Not an enumeration"); |
260 | | - else return t; |
261 | | - } |
262 | | -} |
263 | | -
|
264 | 260 | void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) { |
265 | 261 | std::map<Type::Enum, std::set<int> >::const_iterator i = derived_map.find(e->type()); |
266 | 262 | if (i != derived_map.end()) { |
|
275 | 271 | %(entity_descriptor_attributes)s""" |
276 | 272 |
|
277 | 273 | entity_descriptor_parent = "entity_descriptor_map.find(Type::%(type)s)->second" |
278 | | -entity_descriptor_attribute = ' current->add("%(name)s",%(optional)s,%(type)s);' |
279 | | -entity_descriptor_attribute_enum = ' current->add("%(name)s",%(optional)s,%(type)s,Type::%(enum_type)s);' |
| 274 | +entity_descriptor_attribute_without_entity = ' current->add("%(name)s",%(optional)s,%(type)s);' |
| 275 | +entity_descriptor_attribute_with_entity = ' current->add("%(name)s",%(optional)s,%(type)s,Type::%(entity_name)s);' |
280 | 276 |
|
281 | 277 | enumeration_descriptor = """ values.clear(); values.reserve(128); |
282 | 278 | %(enumeration_descriptor_values)s |
@@ -329,6 +325,7 @@ class %(name)s %(superclass)s{ |
329 | 325 | public: |
330 | 326 | %(attributes)s virtual unsigned int getArgumentCount() const { return %(argument_count)d; } |
331 | 327 | virtual IfcUtil::ArgumentType getArgumentType(unsigned int i) const {%(argument_type_function_body)s} |
| 328 | + virtual Type::Enum getArgumentEntity(unsigned int i) const {%(argument_entity_function_body)s} |
332 | 329 | virtual const char* getArgumentName(unsigned int i) const {%(argument_name_function_body)s} |
333 | 330 | virtual Argument* getArgument(unsigned int i) const { return entity->getArgument(i); } |
334 | 331 | %(inverse)s bool is(Type::Enum v) const; |
|
0 commit comments