Revised version with adapted macros

This commit is contained in:
2025-06-16 15:53:36 +02:00
parent 31ff26cb78
commit 603b3e77af

View File

@ -467,17 +467,18 @@ asynStatus setAxisParam(A *axis, C *controller, const char *indexName,
* ``` * ```
* ============================================================================= * =============================================================================
*/ */
#define setAxisParamChecked(axis, indexGetterFunction, writeValue) \ #define setAxisParamChecked(axis, indexSetterFunction, writeValue) \
{ \ do { \
asynStatus setStatus = setAxisParam( \ auto *ctrlPtr = (axis)->pController(); \
axis, axis->pController(), #indexGetterFunction, \ using ControllerType = \
&std::remove_pointer< \ typename std::remove_pointer<decltype(ctrlPtr)>::type; \
decltype(axis->pController())>::type::indexGetterFunction, \ asynStatus setStatus = \
writeValue, __PRETTY_FUNCTION__, __LINE__); \ setAxisParam(axis, ctrlPtr, #indexSetterFunction, \
if (setStatus != asynSuccess) { \ &ControllerType::indexSetterFunction, writeValue, \
__PRETTY_FUNCTION__, __LINE__); \
if (setStatus != asynSuccess) \
return setStatus; \ return setStatus; \
} \ } while (0)
}
// ============================================================================= // =============================================================================
// Helper functions and definitions for the macro getAxisParamChecked // Helper functions and definitions for the macro getAxisParamChecked
@ -533,15 +534,16 @@ asynStatus getAxisParam(A *axis, C *controller, const char *indexName,
* ============================================================================= * =============================================================================
*/ */
#define getAxisParamChecked(axis, indexGetterFunction, readValue) \ #define getAxisParamChecked(axis, indexGetterFunction, readValue) \
{ \ do { \
asynStatus getStatus = getAxisParam( \ auto *ctrlPtr = (axis)->pController(); \
axis, axis->pController(), #indexGetterFunction, \ using ControllerType = \
&std::remove_pointer< \ typename std::remove_pointer<decltype(ctrlPtr)>::type; \
decltype(axis->pController())>::type::indexGetterFunction, \ asynStatus getStatus = \
readValue, __PRETTY_FUNCTION__, __LINE__); \ getAxisParam(axis, ctrlPtr, #indexGetterFunction, \
if (getStatus != asynSuccess) { \ &ControllerType::indexGetterFunction, readValue, \
__PRETTY_FUNCTION__, __LINE__); \
if (getStatus != asynSuccess) \
return getStatus; \ return getStatus; \
} \ } while (0)
}
#endif #endif