By the way this is documented here: http://code.google.com/apis/protocolbuffers/docs/reference/cpp-generated.html#fields
On Thu, Jan 13, 2011 at 5:42 PM, Jason Hsueh <jas...@google.com> wrote: > > > On Thu, Jan 13, 2011 at 5:38 PM, Linus <suram.su...@gmail.com> wrote: > >> I am new to PB and I just ran into this. Is it possible that the PB >> compiler does not generate set_<...> methods for some nested messages? >> >> Here is an example: I don't see set_<...> methods for ANY of the >> parameters in the db message. >> > > For message type fields, there is no set_<...> method. The codegen produces > mutable_<...> methods instead. Otherwise it is easy to write inefficient > code - set would require a potentially expensive copy of the message. > > >> >> What am I missing??? >> >> package pd; >> >> message nv >> { >> repeated int32 Length = 1; >> } >> >> message dp >> { >> required int32 DesignID = 1; >> repeated double Design = 2; >> } >> >> message Shape >> { >> required int32 size_m = 1; >> required int32 size_n = 2; >> } >> >> message ds >> { >> required int32 DesignID = 1; >> repeated double data = 2; >> } >> >> message db >> { >> required nv numVars = 1; >> repeated dp despar = 2; >> required Shape db_size = 3; >> repeated ds dtst = 4; >> } >> >> >> On Jan 13, 1:48 pm, Linus <suram.su...@gmail.com> wrote: >> > Hello, >> > >> > I have nested messages like the following (it is a little more >> > complicated, but i am trying to simplify with this example). >> > >> > package DB; >> > >> > message Header >> > { >> > required int32 ID=1; >> > message param >> > { >> > required int32 size_m = 1; >> > required int32 size_n = 2; >> > } >> > required param p = 2; >> > >> > } >> > >> > message data >> > { >> > repeated double = 1; >> > >> > } >> > >> > message DB >> > { >> > required Header = 1; >> > required data = 2; >> > >> > } >> > >> > The problem I am having is that the accessor methods generated for the >> > "DB " does not have a >> > set_param( DB::Header::param ). >> > >> > Is there something wrong with how I am structuring my messages? Any >> > help is appreciated. >> > Please let me know if this post is unclear and I will try and explain >> > myself better. >> > >> > Thanks! >> > Linus >> >> -- >> 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<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 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.