| 26 | } |
| 27 | |
| 28 | bool 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 | } |
nothing calls this directly
no test coverage detected