| 60 | } |
| 61 | |
| 62 | PJ::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 | |
| 85 | void LuaSisoTransform::rebuildInstance() { |
| 86 | has_session_start_ = false; |