engiGetEntityName
Syntax
// // Strong typing definition // const char * engiGetEntityName( SdaiEntity entity, SdaiPrimitiveType valueType, const char ** entityName ); static inline const char * engiGetEntityName( SdaiEntity entity, SdaiPrimitiveType valueType, char ** entityName ) { return engiGetEntityName( entity, valueType, (const char**) entityName ); } static inline const char * engiGetEntityName( SdaiEntity entity, SdaiPrimitiveType valueType ) { return engiGetEntityName( entity, valueType, (const char**) nullptr // entityName ); } // // Weak typing definition // const char __declspec(dllexport) * __stdcall engiGetEntityName( int_t entity, int_t valueType, const char ** entityName ); static inline const char * engiGetEntityName( int_t entity, int_t valueType, char ** entityName ) { return engiGetEntityName( entity, valueType, (const char**) entityName ); } static inline const char * engiGetEntityName( int_t entity, int_t valueType ) { return engiGetEntityName( entity, valueType, (const char**) nullptr // entityName ); }
Property entity
Size: 32 bit / 4 byte (value)Property valueType
Size: 32 bit / 4 byte (value)Property entityName
Size: 32 bit / 4 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call engiGetEntityName can be used.
#include "./include/ifcengine.h" #include <iostream> using namespace std; void CreateDetailedAggregation__cout( SdaiAggr aggregation ); void CreateInstance__cout( SdaiInstance instance ) { assert(instance); cout << "#" << internalGetP21Line(instance); } void CreateBoolean__cout( bool value ) { if (value) cout << ".T."; else cout << ".F."; } void CreateLogical__cout( char * value ) { cout << "." << value << "."; } void CreateEnumeration__cout( char * value ) { cout << "." << value << "."; } void CreateReal__cout( double value ) { cout << value; } void CreateInteger__cout( int_t value ) { cout << value; } void CreateString__cout( char * value ) { if (value) cout << "'" << value << "'"; else cout << "''"; } void CreateDetailedADB__cout( SdaiADB ADB ) { cout << sdaiGetADBTypePath(ADB, sdaiSTRING); switch (sdaiGetADBType(ADB)) { case sdaiADB: { SdaiADB attributeDataBlock = 0; if (sdaiGetADBValue(ADB, sdaiADB, &attributeDataBlock)) { CreateDetailedADB__cout(attributeDataBlock); } else { assert(false); cout << "$"; } } break; case sdaiAGGR: { SdaiAggr valueAggr = nullptr; SdaiInstance valueInstance = 0; if (sdaiGetADBValue(ADB, sdaiAGGR, &valueAggr)) { cout << "("; CreateDetailedAggregation__cout(valueAggr); cout << ")"; } else if (sdaiGetADBValue(ADB, sdaiINSTANCE, &valueInstance)) { CreateInstance__cout(valueInstance); } else { assert(false); } } break; case sdaiINSTANCE: { SdaiInstance value = 0; if (sdaiGetADBValue(ADB, sdaiINSTANCE, &value)) { CreateInstance__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiBOOLEAN: { bool value = false; if (sdaiGetADBValue(ADB, sdaiBOOLEAN, &value)) { CreateBoolean__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiLOGICAL: { char * value = nullptr; if (sdaiGetADBValue(ADB, sdaiLOGICAL, &value)) { CreateLogical__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiENUM: { char * value = nullptr; if (sdaiGetADBValue(ADB, sdaiENUM, &value)) { CreateEnumeration__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiREAL: { double value = 0.; if (sdaiGetADBValue(ADB, sdaiREAL, &value)) { CreateReal__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiINTEGER: { int_t value = 0; if (sdaiGetADBValue(ADB, sdaiINTEGER, &value)) { CreateInteger__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiSTRING: { char * value = nullptr; if (sdaiGetADBValue(ADB, sdaiEXPRESSSTRING, &value)) { CreateString__cout(value); } else { assert(false); cout << "$"; } } break; default: assert(false); cout << "??"; break; } cout << ")"; } void CreateDetailedAggregationElement__cout( SdaiAggr aggregation, int_t aggrType, SdaiInteger index ) { switch (aggrType) { case sdaiADB: { SdaiADB attributeDataBlock = 0; if (sdaiGetAggrByIndex(aggregation, index, sdaiADB, &attributeDataBlock)) { CreateDetailedADB__cout(attributeDataBlock); } else { assert(false); cout << "$"; } } break; case sdaiAGGR: { SdaiAggr valueAggr = nullptr; SdaiInstance valueInstance = 0; if (sdaiGetAggrByIndex(aggregation, index, sdaiAGGR, &valueAggr)) { cout << "("; CreateDetailedAggregation__cout(valueAggr); cout << ")"; } else if (sdaiGetAggrByIndex(aggregation, index, sdaiINSTANCE, &valueInstance)) { CreateInstance__cout(valueInstance); } else { assert(false); } } break; case sdaiINSTANCE: { SdaiInstance value = 0; if (sdaiGetAggrByIndex(aggregation, index, sdaiINSTANCE, &value)) { CreateInstance__cout(value); } } break; case sdaiBOOLEAN: { bool value = false; if (sdaiGetAggrByIndex(aggregation, index, sdaiBOOLEAN, &value)) { CreateBoolean__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiLOGICAL: { char * value = nullptr; if (sdaiGetAggrByIndex(aggregation, index, sdaiLOGICAL, &value)) { CreateLogical__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiENUM: { char * value = nullptr; if (sdaiGetAggrByIndex(aggregation, index, sdaiENUM, &value)) { CreateEnumeration__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiREAL: { double value = 0.; if (sdaiGetAggrByIndex(aggregation, index, sdaiREAL, &value)) { CreateReal__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiINTEGER: { int_t value = 0; if (sdaiGetAggrByIndex(aggregation, index, sdaiINTEGER, &value)) { CreateInteger__cout(value); } else { assert(false); cout << "$"; } } break; case sdaiSTRING: { char * value = nullptr; if (sdaiGetAggrByIndex(aggregation, index, sdaiEXPRESSSTRING, &value)) { CreateString__cout(value); } else { assert(false); cout << "$"; } } break; default: assert(false); cout << "??"; break; } } void CreateDetailedAggregation__cout( SdaiAggr aggregation ) { SdaiInteger memberCount = sdaiGetMemberCount(aggregation); if (memberCount == 0) return; int_t aggrType = 0; engiGetAggrType(aggregation, &aggrType); SdaiInteger index = 0; CreateDetailedAggregationElement__cout(aggregation, aggrType, index++); while (index < memberCount) { cout << ", "; CreateDetailedAggregationElement__cout(aggregation, aggrType, index++); } } void CreateDetailedAttribute__cout( SdaiInstance instance, SdaiAttr attribute ) { int_t attrType = engiGetAttrType(attribute); if (attrType & engiTypeFlagAggr || attrType & engiTypeFlagAggrOption) attrType = sdaiAGGR; switch (attrType) { case 0: cout << "$"; break; case sdaiADB: { SdaiADB attributeDataBlock = 0; if (sdaiGetAttr(instance, attribute, sdaiADB, &attributeDataBlock)) { assert(attributeDataBlock); CreateDetailedADB__cout(attributeDataBlock); } else { assert(false); cout << "$"; } } break; case sdaiAGGR: { SdaiAggr valueAggr = nullptr; SdaiInstance valueInstance = 0; if (sdaiGetAttr(instance, attribute, sdaiAGGR, &valueAggr)) { cout << "("; CreateDetailedAggregation__cout(valueAggr); cout << ")"; } else if (sdaiGetAttr(instance, attribute, sdaiINSTANCE, &valueInstance)) { CreateInstance__cout(valueInstance); } else { cout << "$"; } } break; case sdaiINSTANCE: { SdaiInstance value = 0; if (sdaiGetAttr(instance, attribute, sdaiINSTANCE, &value)) { CreateInstance__cout(value); } else { if (engiGetAttrDerived(sdaiGetInstanceType(instance), attribute)) { cout << "*"; } else { cout << "$"; } } } break; case sdaiBOOLEAN: { bool value = false; if (sdaiGetAttr(instance, attribute, sdaiBOOLEAN, &value)) { CreateBoolean__cout(value); } else { cout << "$"; } } break; case sdaiLOGICAL: { char * value = nullptr; if (sdaiGetAttr(instance, attribute, sdaiLOGICAL, &value)) { CreateLogical__cout(value); } else { cout << "$"; } } break; case sdaiENUM: { char * value = nullptr; if (sdaiGetAttr(instance, attribute, sdaiENUM, &value)) { CreateEnumeration__cout(value); } else { cout << "$"; } } break; case sdaiREAL: { double value = 0.; if (sdaiGetAttr(instance, attribute, sdaiREAL, &value)) { CreateReal__cout(value); } else { cout << "$"; } } break; case sdaiINTEGER: { int_t value = 0; if (sdaiGetAttr(instance, attribute, sdaiINTEGER, &value)) { CreateInteger__cout(value); } else { cout << "$"; } } break; case sdaiSTRING: { char * value = nullptr; if (sdaiGetAttr(instance, attribute, sdaiEXPRESSSTRING, &value)) { CreateString__cout(value); } else { cout << "$"; } } break; default: assert(false); cout << "??"; break; } } int_t CreateDetailedInstanceByEntity__cout( SdaiEntity entity, SdaiInstance instance ) { int_t indexOffset = 0; SdaiEntity parentEntity = engiGetEntityParent(entity); if (parentEntity) indexOffset = CreateDetailedInstanceByEntity__cout(parentEntity, instance); char * entityName = nullptr; engiGetEntityName(entity, sdaiSTRING, (const char**) &entityName); if (engiGetEntityIsAbstract(entity)) cout << " Abstract " << entityName << "\n"; else cout << " " << entityName << "\n"; const bool countedWithParents = false, countedWithInverse = true; SdaiInteger index = 0; SdaiAttr attribute = engiGetEntityAttributeByIndex( entity, index++, countedWithParents, countedWithInverse ); while (attribute) { char * attributeName = nullptr; engiGetEntityArgumentName(entity, indexOffset++, sdaiSTRING, (const char**) &attributeName); cout << " "; if (engiGetAttrInverse(attribute)) cout << "Inverse "; cout << attributeName; if (engiGetAttrOptional(attribute)) cout << " (optional)"; cout << " : "; CreateDetailedAttribute__cout(instance, attribute); cout << "\n"; attribute = engiGetEntityAttributeByIndex( entity, index++, countedWithParents, countedWithInverse ); } return indexOffset; } void CreateDetailedInstance__cout( SdaiInstance instance ) { char * entityName = nullptr; engiGetEntityName(sdaiGetInstanceType(instance), sdaiSTRING, (const char**) &entityName); cout << "#" << internalGetP21Line(instance) << " = " << entityName << "( ... )\n"; CreateDetailedInstanceByEntity__cout(sdaiGetInstanceType(instance), instance); }