h.a.s...@gmail.com wrote:
> Something along the lines of :
>
> #DEFINE LOGIN_EVENT_TYPE 0
>
> char * userNameEntry="foo";
>
> RpcChannel logDaemonConnection=new RpcChannel("/tmp/Logdaemon");
>
> Message logMsg= new Message("UserLoginLogEntry");
>
> logMsg.add("username",foo);
>
> logMsg.add("eventType",LOGIN_EVENT_TYPE);
>
> logMsg.add("timestamp","12-02-88 17:22:03);
>
> logDaemonConnection.deliver(logMsg);

Please note that the field names, such as "timestamp" are never in the 
binary data.  The field numbers are what the binary format holds.  So 
the above API is wrong, as the strings are unused and there is no field 
number.

And the binary format is not self-describing, see 
http://code.google.com/apis/protocolbuffers/docs/encoding.html#structure 
for the overlapping formats.  A "varint" could be decoded as one of 
"int32, int64, uint32, uint64, sint32, sint64, bool, enum". And
"Length-delimited" binary data cannot reliably distinguish binary data 
from submessages.

Thus protocol-buffers only makes sense if the message types are 
statically known and fully decoded, or if the messages
are not being decoded at all, such as in  a proxy.  The flexibility with 
extension fields is only useful in special cases for compatibility, such 
as adding annotations to the options in the descriptor.proto itself.

There is room for a reflection based API that reads a "proto" file (or a 
descriptor set binary) at runtime.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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