On 21 jul, 00:22, Kenton Varda <
ken...@google.com> wrote:
> IMO you should just include a tag field which contains some unique
> identifier, as described in the docs you cite.
So I just shouldn't have used your extensions mechanism but rather
added to each message a unique id? Adding it now seems duplicate work
since the extension, in my opinion, already make the distinction
between messages. I am just not able to figure out how to query a
message about its extension without knowing all possibilities up
front...
Using the Reflection API could I do something like this?
for each defined extension:
fdExtensions.push_back(msgReflection.findKnownExtensionByName(extensionName));
and then in the parse method
for(int i;i< fdExtensions; i++)
if(msgReflection.HasField(msg,fdExtensions[i]) {
Parser p = parsers.get(fdExtensions[i]);
if(p != null) p.parse()
}
Or is their a faster way of determining the message's extension?
kind regards
Johan