From d395c7bbb73799ecef5a741a6d8c79d54070ee8c Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 17 Jun 2025 08:51:58 +0200 Subject: [PATCH] Added getAxisParam variant for char arrays --- src/sinqAxis.h | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/sinqAxis.h b/src/sinqAxis.h index 042f1cd..319116e 100644 --- a/src/sinqAxis.h +++ b/src/sinqAxis.h @@ -633,17 +633,6 @@ asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, return asynSuccess; } -template -asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, - int (C::*func)(), char (*readValue)[N], - const char *callerFunctionName, int lineNumber, - TypeTag) { - // Decay the array to char* - return getAxisParamImpl(axis, controller, indexName, func, - static_cast(readValue), callerFunctionName, - lineNumber); -} - template asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, int (C::*func)(), std::string *readValue, @@ -665,7 +654,7 @@ asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, } /** - * @brief Helper function to set an integer / double / string parameter for an + * @brief Helper function to get an integer / double / string parameter for an * axis in the paramLib * * This function should not be used directly, but rather through its macro @@ -692,6 +681,33 @@ asynStatus getAxisParam(A *axis, C *controller, const char *indexName, callerFunctionName, lineNumber, TypeTag{}); } +/** + * @brief Helper function to get an integer / double / string parameter for an + * axis in the paramLib + * + * This function should not be used directly, but rather through its macro + * variant `getAxisParamChecked`. It is a specialized variant of the general + * getAxisParam defined above for char arrays. + * + * @tparam A + * @tparam C + * @tparam N + * @param axis + * @param controller + * @param indexName + * @param func + * @param callerFunctionName + * @param lineNumber + * @return asynStatus + */ +template +asynStatus getAxisParam(A *axis, C *controller, const char *indexName, + int (C::*func)(), char (*readValue)[N], + const char *callerFunctionName, int lineNumber) { + return getAxisParamImpl(axis, controller, indexName, func, readValue, + callerFunctionName, lineNumber, TypeTag{}); +} + /** * @brief Macro to get an paramLib parameter and error checking the return value *