From ff0b3e1274c05fcc8b52c2740b9ea4467f0537eb Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 19 Mar 2026 17:28:29 +0100 Subject: [PATCH] wip --- .../autocomplete/bash_autocomplete.sh | 4 ++-- .../autocomplete/zsh_autocomplete.sh | 4 ++-- slsDetectorSoftware/generator/commands.yaml | 9 +++------ .../generator/extended_commands.yaml | 12 +++++------ slsDetectorSoftware/src/Caller.cpp | 20 ++++--------------- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh index e1450c596..ff46a218a 100644 --- a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh @@ -1895,12 +1895,12 @@ __powername() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" +FCN_RETURN="v_a v_b v_c v_chip v_d v_io" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" +FCN_RETURN="v_a v_b v_c v_chip v_d v_io" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" diff --git a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh index eccaddcc1..92073ccea 100644 --- a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh @@ -1819,12 +1819,12 @@ __powername() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" +FCN_RETURN="v_a v_b v_c v_chip v_d v_io" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" +FCN_RETURN="v_a v_b v_c v_chip v_d v_io" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" diff --git a/slsDetectorSoftware/generator/commands.yaml b/slsDetectorSoftware/generator/commands.yaml index 27b477556..184b2810c 100644 --- a/slsDetectorSoftware/generator/commands.yaml +++ b/slsDetectorSoftware/generator/commands.yaml @@ -2275,19 +2275,15 @@ powername: argc: 1 check_det_id: true function: getPowerName - input: [ 'args[0]' ] - arg_types: [ std::string ] + input: [ 'static_cast(StringTo(args[0]))' ] input_types: [ defs::powerIndex ] - cast_input: [ true ] output: [ 'args[0]',"' '", 't' ] PUT: argc: 2 check_det_id: true function: setPowerName - input: [ 'args[0]', 'args[1]' ] - arg_types: [ std::string, std::string ] + input: [ 'static_cast(StringTo(args[0]))', 'args[1]' ] input_types: [ defs::powerIndex, std::string ] - cast_input: [ true, false ] output: [ 'ToString(args)' ] @@ -2808,6 +2804,7 @@ powervalues: args: - argc: 0 + ################# special commands ########################## virtual: diff --git a/slsDetectorSoftware/generator/extended_commands.yaml b/slsDetectorSoftware/generator/extended_commands.yaml index fac54725e..c61df2654 100644 --- a/slsDetectorSoftware/generator/extended_commands.yaml +++ b/slsDetectorSoftware/generator/extended_commands.yaml @@ -7434,15 +7434,15 @@ powername: GET: args: - arg_types: - - std::string + - defs::powerIndex argc: 1 cast_input: - - true + - false check_det_id: true convert_det_id: true function: getPowerName input: - - args[0] + - static_cast(StringTo(args[0])) input_types: - defs::powerIndex output: @@ -7454,17 +7454,17 @@ powername: PUT: args: - arg_types: - - std::string + - defs::powerIndex - std::string argc: 2 cast_input: - - true + - false - false check_det_id: true convert_det_id: true function: setPowerName input: - - args[0] + - static_cast(StringTo(args[0])) - args[1] input_types: - defs::powerIndex diff --git a/slsDetectorSoftware/src/Caller.cpp b/slsDetectorSoftware/src/Caller.cpp index 6fa587323..c6b99e01e 100644 --- a/slsDetectorSoftware/src/Caller.cpp +++ b/slsDetectorSoftware/src/Caller.cpp @@ -9034,12 +9034,6 @@ std::string Caller::powername(int action) { } if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError( - "Could not convert argument 0 to defs::powerIndex"); - } } } @@ -9050,12 +9044,6 @@ std::string Caller::powername(int action) { } if (args.size() == 2) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError( - "Could not convert argument 0 to defs::powerIndex"); - } } } @@ -9072,8 +9060,8 @@ std::string Caller::powername(int action) { if (det_id != -1) { throw RuntimeError("Cannot execute powername at module level"); } - auto arg0 = StringTo(args[0]); - auto t = det->getPowerName(arg0); + auto t = det->getPowerName( + static_cast(StringTo(args[0]))); os << args[0] << ' ' << t << '\n'; } } @@ -9083,8 +9071,8 @@ std::string Caller::powername(int action) { if (det_id != -1) { throw RuntimeError("Cannot execute powername at module level"); } - auto arg0 = StringTo(args[0]); - det->setPowerName(arg0, args[1]); + det->setPowerName( + static_cast(StringTo(args[0])), args[1]); os << ToString(args) << '\n'; } }