interpretation of empty value strings in json
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -17,12 +17,19 @@ ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string&
|
|||||||
for (json::iterator it = set.begin(); it != set.end(); ++it) {
|
for (json::iterator it = set.begin(); it != set.end(); ++it) {
|
||||||
if ((*it)[arcseckeys::NAME] == name) {
|
if ((*it)[arcseckeys::NAME] == name) {
|
||||||
value = (*it)[arcseckeys::VALUE];
|
value = (*it)[arcseckeys::VALUE];
|
||||||
|
convertEmpty(value);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PARAM_NOT_EXISTS;
|
return PARAM_NOT_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArcsecJsonParamBase::convertEmpty(std::string& value) {
|
||||||
|
if (value == "") {
|
||||||
|
value = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ArcsecJsonParamBase::addfloat(const std::string value, uint8_t* buffer) {
|
void ArcsecJsonParamBase::addfloat(const std::string value, uint8_t* buffer) {
|
||||||
float param = std::stof(value);
|
float param = std::stof(value);
|
||||||
std::memcpy(buffer, ¶m, sizeof(param));
|
std::memcpy(buffer, ¶m, sizeof(param));
|
||||||
|
@ -66,6 +66,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t getParam(const std::string name, std::string& value);
|
ReturnValue_t getParam(const std::string name, std::string& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Converts empty string which is equal to define a value as zero.
|
||||||
|
*/
|
||||||
|
void convertEmpty(std::string& value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function adds a float represented as string to a buffer
|
* @brief This function adds a float represented as string to a buffer
|
||||||
*
|
*
|
||||||
|
2
tmtc
2
tmtc
Submodule tmtc updated: 7b01165ff9...bbae828488
Reference in New Issue
Block a user