MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / map

Method map

src/ifcgeom/mapping/mapping.cpp:693–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691}
692
693taxonomy::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
727namespace {
728 IfcUtil::IfcBaseEntity* get_RelatingObject(IfcSchema::IfcRelDecomposes* decompose) {

Callers 15

addTextAnnotationsMethod · 0.45
setFileMethod · 0.45
format_attributeFunction · 0.45
convertMethod · 0.45
initializeMethod · 0.45
compute_boundsMethod · 0.45
create_element_Method · 0.45
get_objectMethod · 0.45
mapping.hFile · 0.45
operator()Method · 0.45

Calls 5

MessageClass · 0.85
ErrorFunction · 0.50
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected