MCPcopy Create free account
hub / github.com/MITK/MITK / GetNodeData

Method GetNodeData

Modules/RESTAPI/src/mitkDataStorageBridge.cpp:849–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847 }
848
849 DataStorageBridge::GetNodeDataResult DataStorageBridge::GetNodeData(const std::string& uid) const
850 {
851 std::lock_guard<std::mutex> lock(m_Mutex);
852 return this->DispatchTask<GetNodeDataResult>([this, uid]()
853 {
854 GetNodeDataResult result;
855 result.nodeFound = false;
856 result.data = nullptr;
857
858 auto dataStorage = m_DataStorage.Lock();
859 if (dataStorage.IsNull())
860 {
861 return result;
862 }
863
864 auto node = m_UidMapper->FindNodeByUid(uid);
865 if (node == nullptr)
866 {
867 return result; // nodeFound = false
868 }
869
870 result.nodeFound = true;
871
872 auto data = node->GetData();
873 if (data == nullptr)
874 {
875 return result; // nodeFound = true, data = nullptr
876 }
877
878 // Clone the data for thread-safe processing outside the lock
879 // This allows the caller to serialize/process the data without
880 // blocking other DataStorage operations
881 result.data = dynamic_cast<BaseData*>(data->Clone().GetPointer());
882 return result;
883 });
884 }
885
886 DataNode::ConstPointer DataStorageBridge::FindDataNode(const std::string& uid) const
887 {

Calls 6

FindNodeByUidMethod · 0.80
GetPointerMethod · 0.80
LockMethod · 0.45
IsNullMethod · 0.45
GetDataMethod · 0.45
CloneMethod · 0.45

Tested by 3

GetNodeDataWithNoDataMethod · 0.64