Re: Don't understand the purport of default values
Thank you very much for an answer, I thought that I'm missing something when I saw empty debug string. On Jul 5, 3:24 am, Kenton Varda wrote: > The purpose of default values is to define what the getter methods for those > fields return when the field is not set. This is really the only purpose. > We do not serialize default values because it would be a waste of space. > > On Sat, Jul 4, 2009 at 1:47 PM, Zl D wrote: > > > Hi, > > I define a message in .proto file with default values for all > > elements. After instantiation of generated class (C++), calling > > 'PrintDebugString()' or 'SerializeToOstream()' produces no output. If > > I set the any element manually via 'set_' method, then on output I get > > only that value. Calling getter for particular element produces > > output. > > Why cannot I get default values printed out using PrintDebugString() > > method (or serialized via 'SerializeToOstream()')? > > Regards, > > Zlatko --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Don't understand the purport of default values
The purpose of default values is to define what the getter methods for those fields return when the field is not set. This is really the only purpose. We do not serialize default values because it would be a waste of space. On Sat, Jul 4, 2009 at 1:47 PM, Zl D wrote: > > Hi, > I define a message in .proto file with default values for all > elements. After instantiation of generated class (C++), calling > 'PrintDebugString()' or 'SerializeToOstream()' produces no output. If > I set the any element manually via 'set_' method, then on output I get > only that value. Calling getter for particular element produces > output. > Why cannot I get default values printed out using PrintDebugString() > method (or serialized via 'SerializeToOstream()')? > Regards, > Zlatko > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Don't understand the purport of default values
Hi, I define a message in .proto file with default values for all elements. After instantiation of generated class (C++), calling 'PrintDebugString()' or 'SerializeToOstream()' produces no output. If I set the any element manually via 'set_' method, then on output I get only that value. Calling getter for particular element produces output. Why cannot I get default values printed out using PrintDebugString() method (or serialized via 'SerializeToOstream()')? Regards, Zlatko --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---