The different accessor functions for C++ protobuf classes are documented in
detail here:

http://code.google.com/apis/protocolbuffers/docs/reference/cpp-generated.html

Message objects can be large, so you should avoid copying them if possible.
 Instead, you should use the mutable_() accessor to get a pointer to the
sub-message early on, and then modify that sub-message directly, rather than
build a separate object and then copy it.  For example:

DON'T do this:
  Foo foo;
  SetupFoo(&foo);
  Bar bar;
  bar.mutable_foo()->CopyFrom(foo);

Do this instead:
  Bar bar;
  SetupFoo(bar.mutable_foo());

This avoids copying, thus making your code more efficient.  It's also
shorter.

On Wed, Sep 23, 2009 at 8:13 AM, jayt0...@gmail.com <jayt0...@gmail.com>wrote:

>
> I am having trouble accessing many members of my .proto file.  It
> seems that compound members are not accessible with set_() method
> calls.  I saw in your example code the use of mutable_() calls. What
> does this apply to and is there documentation on it? could this be the
> solution to my problem?
>
> Thanks!
>
> Jay
> >
>

--~--~---------~--~----~------------~-------~--~----~
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