MCPcopy Create free account
hub / github.com/Kitware/VTK / uniqueId

Method uniqueId

Rendering/VtkJS/vtkVtkJSSceneGraphSerializer.cxx:150–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150Json::ArrayIndex vtkVtkJSSceneGraphSerializer::Internal::uniqueId(void* ptr)
151{
152 Json::ArrayIndex id;
153 if (ptr == nullptr)
154 {
155 // There is no associated address for this unique id.
156 id = Json::ArrayIndex(UniqueIdCount++);
157 }
158 else
159 {
160 // There is an associated address for this unique id, so we use it to ensure
161 // that subsequent calls will return the same id.
162 auto search = UniqueIds.find(ptr);
163 if (search != UniqueIds.end())
164 {
165 id = search->second;
166 }
167 else
168 {
169 id = Json::ArrayIndex(UniqueIdCount++);
170 UniqueIds[ptr] = id;
171 }
172 }
173 return id;
174}
175
176//------------------------------------------------------------------------------
177vtkStandardNewMacro(vtkVtkJSSceneGraphSerializer);

Callers 1

UniqueIdMethod · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected