I'm implementing a communication system using UDP style client and receiver in C++. My client will send multiple byte streams which represent serialized Protobuf messages. My receiver then receives this data without knowing the exact Protobuf message type.
Is there a way to unpack/deserialize the byte stream into a generic Protobuf message type?
message A {
string nameA = 1;
string numberA = 2;
}
message A {
string nameB = 1;
string numberB = 2;
}
I want to do the following:
::google::protobuf::Message temp;
temp->ParseFromString(inputString);
However, the protobuf compiler wants me to define the 'temp' variable with a specific message type like this:
A temp;
temp->ParseFromString(inputString);
The difference here is that A is an exact message type from my .proto file. I want to use the generic Protobuf message type to unpack the byte stream in.