Added getAxisParam variant for char arrays

This commit is contained in:
2025-06-17 08:51:58 +02:00
parent a6f2890c76
commit d395c7bbb7

View File

@ -633,17 +633,6 @@ asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
return asynSuccess;
}
template <typename A, typename C, size_t N>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), char (*readValue)[N],
const char *callerFunctionName, int lineNumber,
TypeTag<char>) {
// Decay the array to char*
return getAxisParamImpl(axis, controller, indexName, func,
static_cast<char *>(readValue), callerFunctionName,
lineNumber);
}
template <typename A, typename C>
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<T>{});
}
/**
* @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 <typename A, typename C, size_t N>
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<char>{});
}
/**
* @brief Macro to get an paramLib parameter and error checking the return value
*