@brief Given a node, if it's null, try to infer from the parent what it should be. Right now can only infer that the children of an interface are sensors.
| 49 | /// |
| 50 | /// Right now can only infer that the children of an interface are sensors. |
| 51 | inline void ifNullTryInferFromParent(common::PathNode &node) { |
| 52 | if (nullptr == boost::get<elements::NullElement>(&node.value())) { |
| 53 | /// Not null. |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | if (nullptr == node.getParent()) { |
| 58 | // couldn't help, no parent. |
| 59 | return; |
| 60 | } |
| 61 | auto const &parent = *node.getParent(); |
| 62 | |
| 63 | if (nullptr == |
| 64 | boost::get<elements::InterfaceElement>(&(parent.value()))) { |
| 65 | return; // parent isn't an interface. |
| 66 | } |
| 67 | // So if we get here, parent is present and an interface, which means |
| 68 | // that we're a sensor. |
| 69 | node.value() = elements::SensorElement(); |
| 70 | } |
| 71 | |
| 72 | // Forward declaration |
| 73 | void resolveTreeNodeImpl(PathTree &pathTree, std::string const &path, |
no test coverage detected