http://code.google.com/apis/protocolbuffers/docs/techniques.html#union

On Sun, Jan 17, 2010 at 1:21 PM, Johan <freddielunchb...@gmail.com> wrote:

> Hi,
>
> I read data messages that comes in on a TCP/IP socket.
> These message can be of different types example Person, Project etc,
> that I have defined and the corresponding .proto files.
>
> I can do:
>
>    string s((char*)message,  strlen(message));
>    Person p;
>    p.ParseFromString(s))
>
> and then access the object Person.
>
> However, I would like to have it more generic.
> I cannot know from the beginning if the incoming message is a Person
> or a Project or whatever.
> Also, I am not so interested in the access methods, as I plan to loop
> though the Fields using reflection to the decode the object.
>
> Is there a way to decode the 'message' into a generic object (i.e a
> Message) that I can then inspect using reflection?
>
> I can accept to link in the different proto buffers at compile time.
>
> I hope this makes sense.. and thanks for a great protocol !
>
>
> BR
> johan
>
>
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.

Reply via email to