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

Method CountNestedElements

IO/XML/vtkXMLCompositeDataReader.cxx:307–332  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

305
306//------------------------------------------------------------------------------
307unsigned int vtkXMLCompositeDataReader::CountNestedElements(
308 vtkXMLDataElement* element, const std::string& tagName, const std::set<std::string>& exclusions)
309{
310 if (tagName.empty() || element == nullptr)
311 {
312 return 0;
313 }
314
315 unsigned int count = 0;
316 for (unsigned int cc = 0, max = element->GetNumberOfNestedElements(); cc < max; ++cc)
317 {
318 auto child = element->GetNestedElement(cc);
319 if (child && child->GetName())
320 {
321 if (child->GetName() == tagName)
322 {
323 ++count;
324 }
325 else if (exclusions.find(child->GetName()) == exclusions.end())
326 {
327 count += vtkXMLCompositeDataReader::CountNestedElements(child, tagName, exclusions);
328 }
329 }
330 }
331 return count;
332}
333
334//------------------------------------------------------------------------------
335void vtkXMLCompositeDataReader::ReadXMLData()

Callers 1

ReadXMLDataMethod · 0.95

Calls 6

GetNestedElementMethod · 0.80
emptyMethod · 0.45
GetNameMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected