auto desc_set=gproto::FileDescriptorSet(); if (!desc_set.ParseFromString(channel_info.description)) { throw ExporterException("\"" + channel_info.description + "\" is no valid protobuf descriptor."); } std::string error;
auto proto_msg = _proto_decoder.GetProtoMessageFromDescriptorSet(desc_set, StripProtoTopicInfo(channel_info.type), error); if (proto_msg != nullptr) { _proto_msg.reset(proto_msg); } else { throw ExporterException(error); } //create a copy of original message because later we have to parse the original message with const parameter auto new_desc_set = gproto::FileDescriptorSet(); new_desc_set.ParseFromString(channel_info.description);
_modified_msg = _proto_decoder.GetProtoMessageFromDescriptorSet(new_desc_set, StripProtoTopicInfo(channel_info.type), error);void ExporterChannel::SetData(Timestamp timestamp, const MetaData& meta_data, const std::string& payload)
....
_proto_msg->ParseFromString(payload)
....ParseProtobufMessage(_proto_msg.get(), _modified_msg, _proto_msg->GetTypeName());auto refl = msg->GetReflection();
std::vector<const gproto::FieldDescriptor*> field_descs;
refl->ListFields(*msg, &field_descs);refl->SetRepeatedFloat(new_msg, field_desc, index, refl->GetRepeatedFloat(*msg, field_desc, index)*signal.FactorValue.toFloat() + signal.OffsetValue.toFloat()); _modified_msg->SerializeToString(&new_payload_);--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/4225aaeb-a1d1-4b76-906f-0249762dea7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to prot...@googlegroups.com.
ParseProtobufMessage(_proto_msg.get(), _modified_msg, _proto_msg->GetTypeName());