Hi, I have a nested message that i am trying to read using protocol buffers. Message looks like as below
<code> message HeaderMessage { required double timestamp = 1; required string ric_code = 2; required int32 count = 3; required int32 total_message_size = 4; } message CustomMessage { required string field_name = 1; required double value = 2; optional HeaderMessage header = 3; } </code> Here, I am setting the header field in the CustomMessage and writting the custom message to binary output file. I know for sure that the message is written properly to the binary file because I am able to retrive it properly using the C# library (protobuf-net) to read the binary file. I am trying to read the same file using C++ protocol buffers library. But when i read the object from coded_stream cMsg.ParseFromCodedStream(coded_input); I see that the header is not set in the cMsg. I looked inside protocol buffers library. While reading the object, it checks for if header is set or not using the following function inline bool CustomMessage::has_header() const { return (_has_bits_[0] & 0x00000004u) != 0; } Above function returns false and header object is not read. When I am writing the object to binary file, value of _has_bits was 0x00fb6ff8 but when I am reading the custom message from the binary file, this time the value of _has_bits is unchanged before and after reading the object. This value is 0x0012fbcc. For this value, has_header() function returns false. so when I call ParseFromCodedStream function, _has_bits value is not read properly causing a problem in reading header object. What am I doing wrong in this case? How to resolve this issue? Thanks for your help. -Alok -- 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.