4 #ifndef _ZDCJSONConfig_h
5 #define _ZDCJSONConfig_h
7 #include <nlohmann/json.hpp>
32 template<
typename T>
bool
35 if (
value.is_null())
return false;
37 if (
value.type() == paramType) {
38 if (paramSize == -1)
return true;
39 else if (
value.size() ==
size_t(paramSize))
return true;
43 if (
value.is_primitive()) {
44 if (paramType == JSON::value_t::number_float) {
45 if (
value.type() == JSON::value_t::number_integer ||
46 value.type() == JSON::value_t::number_unsigned)
return true;
48 else if (paramType == JSON::value_t::number_integer &&
49 value.type() == JSON::value_t::number_unsigned)
return true;
50 else if (paramType == JSON::value_t::number_integer &&
51 value.type() == JSON::value_t::number_float) {
53 if (std::abs(std::floor(fvalue)-fvalue) < 1
e-6)
return true;
60 template<
typename T>
void
67 if (chanConfig.find(
key) == chanConfig.end()) {
73 template<
typename T>
void
80 template<
typename T>
void
94 template<
typename T> std::pair<bool, std::string>
95 ParsePerChannelParams(
const std::string& paramKey,
const T& paramValue, JSON::value_t paramType,
size_t paramSize);
100 ZDCJSONConfig(
const std::vector<std::string>& sideNames,
size_t numChannelsPerSide) :
121 if (
iter.value().is_null())
return false;
123 returnValue =
iter.value().get_to(returnValue);