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

Method GetOrCreateUid

Modules/RESTAPI/src/mitkNodeUidMapper.cpp:93–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93std::string NodeUidMapper::GetOrCreateUid(DataNode* node)
94{
95 if (node == nullptr)
96 {
97 throw std::invalid_argument("Node cannot be null");
98 }
99
100 std::lock_guard<std::mutex> lock(m_Mutex);
101
102 // Check cache first
103 auto it = m_NodeToUid.find(node);
104 if (it != m_NodeToUid.end())
105 {
106 return it->second;
107 }
108
109 // Generate new UID
110 std::string uid = this->GenerateUid();
111
112 // Store in cache
113 m_UidToNode[uid] = node;
114 m_NodeToUid[node] = uid;
115
116 // Store as property for debugging visibility
117 node->SetStringProperty(UID_PROPERTY_KEY, uid.c_str());
118
119 return uid;
120}
121
122DataNode::Pointer NodeUidMapper::FindNodeByUid(const std::string& uid) const
123{

Callers 12

GeneratesUniqueUidsMethod · 0.80
ThrowsOnNullNodeMethod · 0.80
GetNodeUidMethod · 0.80
GetNodesMethod · 0.80
CreateNodeMethod · 0.80
DeleteNodeMethod · 0.80
NodeToJsonMethod · 0.80

Calls 4

GenerateUidMethod · 0.95
findMethod · 0.45
endMethod · 0.45
SetStringPropertyMethod · 0.45