Compare commits
7 Commits
a6f2890c76
...
07cab3ac2a
Author | SHA1 | Date | |
---|---|---|---|
07cab3ac2a | |||
e194736206 | |||
30af284f5d | |||
6069aa9194 | |||
c475beee66 | |||
b1fe452ed6 | |||
d395c7bbb7 |
@ -571,7 +571,7 @@ template <typename A, typename C, typename T>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), T *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
TypeTag<void>) {
|
||||
size_t msgSize, TypeTag<void>) {
|
||||
static_assert(
|
||||
sizeof(T) == 0,
|
||||
"no specialization of getAxisParam exists for the given type");
|
||||
@ -582,7 +582,7 @@ template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), int *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
TypeTag<int>) {
|
||||
size_t msgSize, TypeTag<int>) {
|
||||
int indexValue = (controller->*func)();
|
||||
asynStatus status =
|
||||
controller->getIntegerParam(axis->axisNo(), indexValue, readValue);
|
||||
@ -597,16 +597,20 @@ template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), bool *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
TypeTag<bool>) {
|
||||
return getAxisParamImpl(axis, indexName, func, (int *)readValue,
|
||||
callerFunctionName, lineNumber);
|
||||
size_t msgSize, TypeTag<bool>) {
|
||||
int readValueInt = 0;
|
||||
asynStatus status =
|
||||
getAxisParamImpl(axis, indexName, func, &readValueInt,
|
||||
callerFunctionName, lineNumber, msgSize);
|
||||
*readValue = readValueInt != 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), double *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
TypeTag<double>) {
|
||||
size_t msgSize, TypeTag<double>) {
|
||||
int indexValue = (controller->*func)();
|
||||
asynStatus status =
|
||||
controller->getDoubleParam(axis->axisNo(), indexValue, readValue);
|
||||
@ -621,11 +625,11 @@ template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), char *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
TypeTag<char>) {
|
||||
size_t msgSize, TypeTag<char>) {
|
||||
|
||||
int indexValue = (controller->*func)();
|
||||
asynStatus status = controller->getStringParam(
|
||||
axis->axisNo(), indexValue, controller->msgSize(), readValue);
|
||||
asynStatus status = controller->getStringParam(axis->axisNo(), indexValue,
|
||||
msgSize, readValue);
|
||||
if (status != asynSuccess) {
|
||||
return controller->paramLibAccessFailed(
|
||||
status, indexName, axis->axisNo(), callerFunctionName, lineNumber);
|
||||
@ -633,22 +637,11 @@ 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,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
TypeTag<std::string>) {
|
||||
size_t msgSize, TypeTag<std::string>) {
|
||||
int indexValue = (controller->*func)();
|
||||
|
||||
// Convert the pointer to a reference, since getStringParam expects the
|
||||
@ -665,7 +658,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
|
||||
@ -689,7 +682,35 @@ asynStatus getAxisParam(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), T *readValue,
|
||||
const char *callerFunctionName, int lineNumber) {
|
||||
return getAxisParamImpl(axis, controller, indexName, func, readValue,
|
||||
callerFunctionName, lineNumber, TypeTag<T>{});
|
||||
callerFunctionName, lineNumber,
|
||||
controller->msgSize(), TypeTag<T>{});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper function to get a string parameter for an
|
||||
* axis in the paramLib into a char array
|
||||
*
|
||||
* 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, N, TypeTag<char>{});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user