MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / remove_levels_if

Function remove_levels_if

apps/RecomposeTransform.h:41–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39/// on.
40template <typename Predicate>
41inline Json::Value remove_levels_if(Json::Value input, Predicate p) {
42 namespace keys = osvr::common::routing_keys;
43 std::vector<Json::Value> levels;
44 Json::Value current = input;
45 while (current.isMember(keys::child()) &&
46 current[keys::child()].isObject()) {
47 if (!p(current)) {
48 levels.push_back(current);
49 }
50 current = current[keys::child()];
51 }
52 while (levels.size() > 0) {
53 Json::Value next = levels.back();
54 levels.pop_back();
55 next[keys::child()] = current;
56 current = next;
57 }
58 return current;
59}
60
61#endif // INCLUDED_RecomposeTransform_h_GUID_4CA04427_C4DC_4898_8938_D735D4A6C056

Callers 2

mainFunction · 0.85
removeCalibrationFunction · 0.85

Calls 4

childFunction · 0.85
backMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected