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

Method CheckNode

Modules/Core/src/DataManagement/mitkNodePredicateDataProperty.cpp:28–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28bool mitk::NodePredicateDataProperty::CheckNode(const mitk::DataNode *node) const
29{
30 if (node == nullptr)
31 {
32 mitkThrow() << "NodePredicateDataProperty cannot check invalid node";
33 }
34
35 if (m_ValidPropertyName.empty())
36 {
37 mitkThrow() << "NodePredicateDataProperty cannot check invalid (empty) property name";
38 }
39
40 bool result = false;
41 auto data = node->GetData();
42 if (data)
43 {
44 if (m_ValidProperty.IsNull())
45 {
46 result = data->GetProperty(m_ValidPropertyName.c_str()).IsNotNull(); // search only for name
47 }
48 else
49 {
50 mitk::BaseProperty::Pointer p = data->GetProperty(m_ValidPropertyName.c_str());
51
52 if (p.IsNotNull())
53 {
54 result = (*p == *m_ValidProperty);
55 }
56 }
57 }
58 return result;
59}

Callers

nothing calls this directly

Calls 5

IsNotNullMethod · 0.80
emptyMethod · 0.45
GetDataMethod · 0.45
IsNullMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected