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

Method FindNodeByUid

Modules/RESTAPI/src/mitkNodeUidMapper.cpp:122–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122DataNode::Pointer NodeUidMapper::FindNodeByUid(const std::string& uid) const
123{
124 std::lock_guard<std::mutex> lock(m_Mutex);
125
126 auto it = m_UidToNode.find(uid);
127 if (it != m_UidToNode.end())
128 {
129 // Lock() atomically upgrades the WeakPointer to a strong reference.
130 // This is safe under the mutex: OnNodeRemoved (which precedes DataStorage
131 // releasing its reference) also requires this mutex, so a non-null
132 // WeakPointer is guaranteed to refer to a live node here.
133 return it->second.Lock();
134 }
135 return DataNode::Pointer();
136}
137
138std::optional<std::string> NodeUidMapper::GetUid(const DataNode* node) const
139{

Callers 15

GetNodeMethod · 0.80
CreateNodeMethod · 0.80
UpdateNodeMethod · 0.80
DeleteNodeMethod · 0.80
GetNodeDataMethod · 0.80
FindDataNodeMethod · 0.80
SetNodeDataMethod · 0.80
GetNodePropertiesMethod · 0.80
GetNodePropertyMethod · 0.80

Calls 3

findMethod · 0.45
endMethod · 0.45
LockMethod · 0.45

Tested by 3