20 const auto schemaEncoding =
21 j.find(
"schemaEncoding") == j.end()
22 ? std::optional<std::string>(std::nullopt)
23 : std::optional<std::string>(j[
"schemaEncoding"].get<std::string>());
25 ChannelWithoutId channelWithoutId{j[
"topic"].get<std::string>(), j[
"encoding"].get<std::string>(),
26 j[
"schemaName"].get<std::string>(),
27 j[
"schema"].get<std::string>(), schemaEncoding};
28 c =
Channel(j[
"id"].get<ChannelId>(), channelWithoutId);
32 const auto paramType = p.
getType();
42 const auto& paramValue = p.
getValue<std::vector<unsigned char>>();
43 const std::string_view strValue(
reinterpret_cast<const char*
>(paramValue.data()),
47 j = p.
getValue<std::unordered_map<std::string, ParameterValue>>();
49 j = p.
getValue<std::vector<ParameterValue>>();
56 const auto jsonType = j.type();
58 if (jsonType == nlohmann::detail::value_t::string) {
60 }
else if (jsonType == nlohmann::detail::value_t::boolean) {
62 }
else if (jsonType == nlohmann::detail::value_t::number_integer) {
64 }
else if (jsonType == nlohmann::detail::value_t::number_unsigned) {
66 }
else if (jsonType == nlohmann::detail::value_t::number_float) {
68 }
else if (jsonType == nlohmann::detail::value_t::object) {
69 p =
ParameterValue(j.get<std::unordered_map<std::string, ParameterValue>>());
70 }
else if (jsonType == nlohmann::detail::value_t::array) {
79 j[
"type"] =
"byte_array";
81 j[
"type"] =
"float64";
85 j[
"type"] =
"float64_array";
91 const auto name = j[
"name"].get<std::string>();
93 if (j.find(
"value") == j.end()) {
100 const auto typeIt = j.find(
"type");
101 const std::string type = typeIt != j.end() ? typeIt->get<std::string>() :
"";
110 auto values = pValue.
getValue<std::vector<ParameterValue>>();
113 value =
ParameterValue(
static_cast<double>(value.getValue<int64_t>()));
115 throw std::runtime_error(
"Parameter '" + name +
116 "' (float64_array) contains non-numeric elements.");
128 {
"name", service.
name},
129 {
"type", service.
type},
137 p.
name = j[
"name"].get<std::string>();
138 p.
type = j[
"type"].get<std::string>();
149 const size_t encondingLength =
static_cast<size_t>(
ReadUint32LE(
data + offset));
151 this->
encoding = std::string(
reinterpret_cast<const char*
>(
data + offset), encondingLength);
152 offset += encondingLength;
153 const auto payloadLength = dataLength - offset;
154 this->data.resize(payloadLength);
155 std::memcpy(this->data.data(),
data + offset, payloadLength);
166 std::memcpy(
data + offset, this->
encoding.data(), this->encoding.size());
168 std::memcpy(
data + offset, this->data.data(), this->data.size());