| 691 | } |
| 692 | |
| 693 | taxonomy::ptr mapping::map(const IfcBaseInterface* inst) { |
| 694 | if (inst == nullptr) { |
| 695 | Logger::Error("Warning nullptr passed to map() function"); |
| 696 | return nullptr; |
| 697 | } |
| 698 | auto iden = inst->as<IfcUtil::IfcBaseClass>()->identity(); |
| 699 | if (use_caching_) { |
| 700 | std::lock_guard<std::mutex> guard(cache_guard_); |
| 701 | auto it = cache_.find(iden); |
| 702 | if (it != cache_.end()) { |
| 703 | return it->second; |
| 704 | } |
| 705 | } |
| 706 | taxonomy::ptr item = nullptr; |
| 707 | |
| 708 | // @todo we should check whether there is a notice performance impact on the large sequence |
| 709 | // of if-statements and whether a switch on e.g inst->declaration()->index_in_schema() |
| 710 | // isn't more efficient (which would disable inheritance though). |
| 711 | |
| 712 | bool matched = false; |
| 713 | |
| 714 | #include "bind_convert_impl.i" |
| 715 | |
| 716 | if (item) { |
| 717 | if (use_caching_) { |
| 718 | std::lock_guard<std::mutex> guard(cache_guard_); |
| 719 | cache_.insert({iden, item}); |
| 720 | } |
| 721 | } else if (!matched) { |
| 722 | Logger::Message(Logger::LOG_ERROR, "No operation defined for:", inst); |
| 723 | } |
| 724 | return item; |
| 725 | } |
| 726 | |
| 727 | namespace { |
| 728 | IfcUtil::IfcBaseEntity* get_RelatingObject(IfcSchema::IfcRelDecomposes* decompose) { |
no test coverage detected