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