Added a license (GPL3)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
/*
|
||||
This class extends asynMotorAxis by some features used in SINQ.
|
||||
|
||||
@@ -464,12 +466,16 @@ asynStatus setAxisParam(sinqAxis *axis, const char *indexName,
|
||||
* @param readValue
|
||||
* @param callerFunctionName
|
||||
* @param lineNumber
|
||||
* @param maxChars Only used when readValue is a char*. Specifies the maximum
|
||||
* number of characters which can be placed into the buffer the pointer points
|
||||
* to.
|
||||
* @return asynStatus
|
||||
*/
|
||||
template <typename T>
|
||||
asynStatus getAxisParam(sinqAxis *axis, const char *indexName,
|
||||
int (sinqController::*func)(), T *readValue,
|
||||
const char *callerFunctionName, int lineNumber);
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
int maxChars = 0);
|
||||
|
||||
/**
|
||||
* @brief Macro to get an paramLib parameter and error checking the return value
|
||||
@@ -495,15 +501,35 @@ asynStatus getAxisParam(sinqAxis *axis, const char *indexName,
|
||||
* return asynSuccess;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If `readValue` is a `char *`, the size of the buffer needs to be provided as
|
||||
* well:
|
||||
* ```
|
||||
* char readValue[20] = {0};
|
||||
* getAxisParamChecked(this, motorStatusProblem_, &readValue, sizeof(readValue))
|
||||
* ```
|
||||
* expands to
|
||||
* ```
|
||||
* {
|
||||
* int indexValue = axis->pController()->motorStatusProblem_();
|
||||
* asynStatus status = axis->pController()->getStringParam(axis->axisNo(),
|
||||
* indexValue, sizeof(readValue), readValue); if (status != asynSuccess) {
|
||||
* return axis->pController()->paramLibAccessFailed( status,
|
||||
* "motorStatusProblem_", axis->axisNo(), __PRETTY_FUNCTION__,
|
||||
* __LINE__);
|
||||
* }
|
||||
* return asynSuccess;
|
||||
* }
|
||||
* ```
|
||||
* =============================================================================
|
||||
*/
|
||||
#define getAxisParamChecked(axis, indexGetterFunction, readValue) \
|
||||
#define getAxisParamChecked(axis, indexGetterFunction, readValue, ...) \
|
||||
{ \
|
||||
asynStatus getStatus = getAxisParam( \
|
||||
axis, #indexGetterFunction, \
|
||||
&std::remove_pointer< \
|
||||
decltype(axis->pController())>::type::indexGetterFunction, \
|
||||
readValue, __PRETTY_FUNCTION__, __LINE__); \
|
||||
readValue, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \
|
||||
if (getStatus != asynSuccess) { \
|
||||
return getStatus; \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user