[protobuf] accessor method for message type
hello, I am new to protocol buffer and try to follow through the following example that can encode different message type: message OneMessage { enum Type { FOO = 1; BAR = 2; BAZ = 3; } // Identifies which field is filled in. required Type type = 1; // One of the following will be filled in. optional Foo foo = 2; optional Bar bar = 3; optional Baz baz = 4; } So the from generated code, I would expect an access method such as set_foo() set_bar and set_baz() so that I can connect Foo object to the message. But I don't see it at all, there are methods such as has_foo() has_bar() and has_baz() etc. What did I miss? TIA Oliver -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] is protobuf the right choice in this case?
Hi all, I'm working on a project that involves two layers: one is written in C++ and the other one in Javascript. The C++ layer contains the model of the application in form of a tree in a similar way as HTML does (nothing really complicated, just elements with attributes). The interaction between these two layers is done using JSON. We manually implement the classes that serialize/deserialize JSON requests/responses and it is becoming a waste of time (plus the impact in maintenance). I was thinking about using protocol buffers to describe our model in terms of .proto files and then write a layer that automatically performs the serialization/deserialization to/from JSON according to our schemas. I started to look at protocol buffers recently so I might be asking something stupid. My question is: is protobuf the right choice to represent our data model when: 1. the model consists of hierarchy of classes. 2. a model instance is a tree (objects are connected creating a tree structure) 3. the model not static: these tree suffer changes (tree operations like add/delete/move/update nodes, etc.) Thanks in advance. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] Re: how to calculate protocol buffer message size without parsing the full message?
Can't you use ByteSize() method to get the size? Oliver On Sunday, April 21, 2013 12:07:57 AM UTC-4, Sean Nguyen wrote: Hi, I want to calculate the protocol buffer message size without reading the stream to the end? I don't see the size of the outer most message is stored. For example: message Person { optional string name = 1; optional uint32 age = 2; } There is no size store for the Person message if it is the outer most message. Is that correct? If it is not where I can find it? Thanks, Son Nguyen -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] accessor method for message type
On Sat, Apr 20, 2013 at 4:38 PM, Oliver Wang python...@gmail.com wrote: So the from generated code, I would expect an access method such as set_foo() set_bar and set_baz() so that I can connect Foo object to the message. But I don't see it at all, there are methods such as has_foo() has_bar() and has_baz() etc. What language are you using? For C++, see https://developers.google.com/protocol-buffers/docs/reference/cpp-generated, Singular Embedded Message Fields Oliver -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] Re: how to calculate protocol buffer message size without parsing the full message?
On Sun, Apr 21, 2013 at 9:48 PM, Oliver Wang python...@gmail.com wrote: Can't you use ByteSize() method to get the size? Not when you're parsing - you don't have a message instance yet! Oliver -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] is protobuf the right choice in this case?
Am 20.04.2013 um 14:17 schrieb balche8 anibal.cheha...@gmail.com: Hi all, I'm working on a project that involves two layers: one is written in C++ and the other one in Javascript. The C++ layer contains the model of the application in form of a tree in a similar way as HTML does (nothing really complicated, just elements with attributes). The interaction between these two layers is done using JSON. We manually implement the classes that serialize/deserialize JSON requests/responses and it is becoming a waste of time (plus the impact in maintenance). Why are you doing it manually? The protobuf schema and introspection capabilities are strong enough to support completely automatic conversion while validating against the protobuf schema see a Python example here: translator: http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=src/protobuf/examples/json.py;h=80c21ca23f8673afead2c0afc9870344ca8a1975;hb=0623bcc7d68029bea378045e57cdcf7dc5216f7f usage: http://git.mah.priv.at/gitweb?p=emc2-dev.git;a=blob;f=src/protobuf/examples/encdec.py;h=4e947b67dd57501f4645c3cca7696281b61cc9f5;hb=0623bcc7d68029bea378045e57cdcf7dc5216f7f needs cleaning to run standalone, but you get the idea what I think the best route is to redo the above in C++, maybe starting with this https://github.com/renenglish/pb2json and doing the other direction based on the ideas above - Michael I was thinking about using protocol buffers to describe our model in terms of .proto files and then write a layer that automatically performs the serialization/deserialization to/from JSON according to our schemas. I started to look at protocol buffers recently so I might be asking something stupid. My question is: is protobuf the right choice to represent our data model when: 1. the model consists of hierarchy of classes. 2. a model instance is a tree (objects are connected creating a tree structure) 3. the model not static: these tree suffer changes (tree operations like add/delete/move/update nodes, etc.) Thanks in advance. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] new code generator: protobuf-nginx
Hi, I've written a Google Protocol Buffers code generator for nginx module developers interested in using protobuf messages within nginx natively. The project is on Github here: https://github.com/dbcode/protobuf-nginx/ Please let me know if you can add it to the Third Party Add-Ons wiki page: http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns I suppose it would go under the C programming language section, although the generated code is only suitable for use within nginx itself. -dave -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] new code generator: protobuf-nginx
What's special for nginx? Can this code generator be used for not-nginx-releated projects? On Mon, Apr 22, 2013 at 9:27 AM, d...@daveb.net wrote: Hi, I've written a Google Protocol Buffers code generator for nginx module developers interested in using protobuf messages within nginx natively. The project is on Github here: https://github.com/dbcode/**protobuf-nginx/https://github.com/dbcode/protobuf-nginx/ Please let me know if you can add it to the Third Party Add-Ons wiki page: http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns I suppose it would go under the C programming language section, although the generated code is only suitable for use within nginx itself. -dave -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] new code generator: protobuf-nginx
The generated code relies on nginx-specific types such as its typedefs for strings, arrays, and rbtrees, and also its memory pools and so on. The generated code is meant to be compiled into the nginx binary, which is currently the way all module development is done with nginx. -dave On Apr 22, 2013, at 11:15, Feng Xiao xiaof...@google.com wrote: What's special for nginx? Can this code generator be used for not-nginx-releated projects? On Mon, Apr 22, 2013 at 9:27 AM, d...@daveb.net wrote: Hi, I've written a Google Protocol Buffers code generator for nginx module developers interested in using protobuf messages within nginx natively. The project is on Github here: https://github.com/dbcode/protobuf-nginx/ Please let me know if you can add it to the Third Party Add-Ons wiki page: http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns I suppose it would go under the C programming language section, although the generated code is only suitable for use within nginx itself. -dave -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] new code generator: protobuf-nginx
I think it's better to list it in the other utilities section as it's not a general C solution but specified for nginx. Does this sound good to you? I'll add it to the wiki page if you are ok with it. On Mon, Apr 22, 2013 at 11:28 AM, Dave Bailey d...@daveb.net wrote: The generated code relies on nginx-specific types such as its typedefs for strings, arrays, and rbtrees, and also its memory pools and so on. The generated code is meant to be compiled into the nginx binary, which is currently the way all module development is done with nginx. -dave On Apr 22, 2013, at 11:15, Feng Xiao xiaof...@google.com wrote: What's special for nginx? Can this code generator be used for not-nginx-releated projects? On Mon, Apr 22, 2013 at 9:27 AM, d...@daveb.netd...@daveb.net wrote: Hi, I've written a Google Protocol Buffers code generator for nginx module developers interested in using protobuf messages within nginx natively. The project is on Github here: https://github.com/dbcode/protobuf-nginx/https://github.com/dbcode/** protobuf-nginx/ Please let me know if you can add it to the Third Party Add-Ons wiki page: http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns I suppose it would go under the C programming language section, although the generated code is only suitable for use within nginx itself. -dave -- 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%2bunsubscr...@googlegroups.com protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] new code generator: protobuf-nginx
Thank you, that sounds good to me. -dave On Apr 22, 2013, at 11:36, Feng Xiao xiaof...@google.com wrote: I think it's better to list it in the other utilities section as it's not a general C solution but specified for nginx. Does this sound good to you? I'll add it to the wiki page if you are ok with it. On Mon, Apr 22, 2013 at 11:28 AM, Dave Bailey d...@daveb.net wrote: The generated code relies on nginx-specific types such as its typedefs for strings, arrays, and rbtrees, and also its memory pools and so on. The generated code is meant to be compiled into the nginx binary, which is currently the way all module development is done with nginx. -dave On Apr 22, 2013, at 11:15, Feng Xiao xiaof...@google.com wrote: What's special for nginx? Can this code generator be used for not-nginx-releated projects? On Mon, Apr 22, 2013 at 9:27 AM, d...@daveb.net wrote: Hi, I've written a Google Protocol Buffers code generator for nginx module developers interested in using protobuf messages within nginx natively. The project is on Github here: https://github.com/dbcode/protobuf-nginx/ Please let me know if you can add it to the Third Party Add-Ons wiki page: http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns I suppose it would go under the C programming language section, although the generated code is only suitable for use within nginx itself. -dave -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] Re: Python3 Protobufs
Charles, Thanks for taking the time to do this! Is it possible to make your github repo be based off of the latest svn checkout of GPB? I have used the instructions here [0] to do this for other projects where I wanted to use git but the official code was managed with svn (as in this case). The nice thing about this is then hopefully your work could be merged into GPB down the road since it would be based off the most recent commit and the merge conflicts would be eliminated. It looks like your initial svn checkout of the GPB repos was a year ago so all the python3 tests you've got are based on version 2.4.1. I've already set up git svn clone of the official google protobuf svn repo here: https://github.com/hazelnusse/protobuf-git-svn If you were to clone this and see if you could apply all your patches to the latest svn checkout, then hopefully the maintainers of GPB would be more willing to get the ball rolling on Python3. Let me know if I can help at all, I am using GPB in a project where everything else is Python 3 but I have to also make sure Python 2 is available and it would be nice if GBP supported both. Luke [0] -- http://stackoverflow.com/questions/465042/is-it-possible-to-have-a-subversion-repository-as-a-git-submodule -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[protobuf] 2.5.0 C++ performance summary
Apologies if this is an FAQ but I see the release notes state C++ optimizations were made, is there a list of those changes anywhere please? is this the atomic opt stuff only? What's the expected (ballpark) improvement over 2.4.x? Thank in advance. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [protobuf] 2.5.0 C++ performance summary
On Mon, Apr 22, 2013 at 2:27 PM, Stephen Townsend stevetownse...@gmail.comwrote: Apologies if this is an FAQ but I see the release notes state C++ optimizations were made, is there a list of those changes anywhere please? is this the atomic opt stuff only? What's the expected (ballpark) improvement over 2.4.x? There are a few small optimizations made (sorry I don't remember any...) but the overall performance doesn't have a noticeable change. I would say the performance is on par with 2.4.x. Basically the performance of protobuf won't change much now unless there is a significant design change (e.g., wire format change) or some significant new features are supported (e..g, union, bulk memory allocation). If that happens it will definitely be mentioned in the document. Thank in advance. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf?hl=en. For more options, visit https://groups.google.com/groups/opt_out.