12 std::string resultString =
"success";
14 for (
auto [key, value] :
config.items()) {
16 if (value.is_null()) {
18 resultString =
"Found null value for parameter " + key;
25 auto iter = configParamList.find(key);
26 if (iter == configParamList.end()) {
28 resultString =
"Found unknown parameter: " + key +
": JSON=" +
config.dump();
32 auto paramType = std::get<0>(iter->second);
33 auto paramSize = std::get<1>(iter->second);
34 auto paramSingleOnly = !std::get<2>(iter->second);
38 if (paramSingleOnly) {
39 if (!
checkType(value, paramType, paramSize)) {
41 resultString =
"Incorrect JSON type for parameter " + key;
60 if (value.type() == JSON::value_t::object) {
64 resultString = std::move(ppcResultString);
69 if (!
checkType(value, paramType, paramSize)) {
71 resultString =
"Incorrect JSON type for parameter " + key;
84 return {
result, resultString};
91 std::string resultString =
"success";
93 for (
auto [key, value] : paramValue.items()) {
99 for (
unsigned int side = 0; side <
m_nSides; side++) {
110 if (value.size() == 1) {
117 resultString =
"Incorrect JSON type for parameter " + key;
124 else if (paramType == JSON::value_t::array) {
126 size_t elementSize = value[0].size();
127 size_t arrayLength = value.size();
134 else if (arrayLength == paramSize) {
142 resultString =
"Invalid value format for array parameter " + paramKey +
" on side " +
m_sideLabels[side];
146 else if (paramType == JSON::value_t::object) {
157 resultString =
"Invalid array length for parameter " + paramKey +
" on side " +
m_sideLabels[side];
165 if (!
checkType(value[chan], paramType)) {
167 resultString =
"Incorrect JSON type for parameter " + paramKey +
"paramType = " +
168 std::to_string((
unsigned int) paramType) +
", value type = " + std::to_string((
unsigned int) value[chan].
type());
180 std::string keyRemainder = key.substr(
m_sideLabels[side].size(), std::string::npos);
182 int chanIndex = std::stoi(keyRemainder);
185 resultString =
"Invalid channel specifier in values for parameter " + key;
189 if (!
checkType(value, paramType, paramSize)) {
191 resultString =
"Incorrect JSON type for parameter " + key;
199 resultString =
"Invalid channel specifier for parameter " + key;
209 resultString =
"Exception caught while parsing key " + key;
213 return {
result, resultString};