MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / makeOutputValue

Method makeOutputValue

pj_scripting/src/lua_siso_transform.cpp:62–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62PJ::VarValue LuaSisoTransform::makeOutputValue(double computed, const PJ::VarValue& input) const {
63 switch (out_mode_) {
64 case OutputMode::kInt64:
65 return PJ::VarValue{toInt64(computed)};
66 case OutputMode::kMirror:
67 return std::visit(
68 [computed](auto&& arg) -> PJ::VarValue {
69 using T = std::decay_t<decltype(arg)>;
70 if constexpr (std::is_same_v<T, std::int64_t>) {
71 return PJ::VarValue{toInt64(computed)};
72 } else if constexpr (std::is_same_v<T, std::uint64_t>) {
73 return PJ::VarValue{toUint64(computed)};
74 } else {
75 return PJ::VarValue{computed}; // double or string-input → double output
76 }
77 },
78 input);
79 case OutputMode::kDouble:
80 default:
81 return PJ::VarValue{computed};
82 }
83}
84
85void LuaSisoTransform::rebuildInstance() {
86 has_session_start_ = false;

Callers

nothing calls this directly

Calls 2

toInt64Function · 0.70
toUint64Function · 0.70

Tested by

no test coverage detected