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:
parent
9c42b861f4
commit
86581d81c9
@ -17,12 +17,19 @@ ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string&
|
||||
for (json::iterator it = set.begin(); it != set.end(); ++it) {
|
||||
if ((*it)[arcseckeys::NAME] == name) {
|
||||
value = (*it)[arcseckeys::VALUE];
|
||||
convertEmpty(value);
|
||||
return RETURN_OK;
|
||||
}
|
||||
}
|
||||
return PARAM_NOT_EXISTS;
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::convertEmpty(std::string& value) {
|
||||
if (value == "") {
|
||||
value = "0";
|
||||
}
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::addfloat(const std::string value, uint8_t* buffer) {
|
||||
float param = std::stof(value);
|
||||
std::memcpy(buffer, ¶m, sizeof(param));
|
||||
|
@ -66,6 +66,11 @@ protected:
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 7b01165ff937e45e052caeb550e622a8b9df6ee2
|
||||
Subproject commit bbae8284884ebfd49655e0a806e0d1288f4a7a70
|
Loading…
Reference in New Issue
Block a user