[protobuf] Serializing List of Objects
How can we serialize list of objects by using protobuf-net? Is protobuf-net support list of objects like public List(ABC) DEF { get; set; } -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/W0yySDcbES8J. 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: [protobuf] Serializing List of Objects
(note: this is specific to protobuf-net, not protocol buffers more widely), but yes: that (a generic list) would work fine, as long as the property has been marked for serialization and given a number. There also doesn't need to be a set accessor, although it can make full use of a set - i.e. if it finds the list is null, it will create a new list of the appropriate type and use the set to update the object. So, your code would be fine if it has been designated a number, or a related example: [ProtoMember(4)] public ListOrder Orders { get { return orders; } } private readonly ListOrder orders = new ListOrder(); Marc (protobuf-net) On 20 June 2012 13:08, Farooq Mushtaq farooqmushta...@gmail.com wrote: How can we serialize list of objects by using protobuf-net? Is protobuf-net support list of objects like public List(ABC) DEF { get; set; } -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/W0yySDcbES8J. 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. -- Regards, Marc -- 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: [protobuf] Best practices for proto file organization in large projects
Okay, so I got this build tree working. I had to: (1) Modify FindProtobuf.cmake (the build rule) so that I can specify the proto_path (2) Modify each .proto import to specify the file to import using the full path from the root, even if the files are parallel to the .proto source. (3) Add CMAKE_SOURCE_DIR (the source tree root) to the proto_path (4) Add CMAKE_BINARY_DIR (the build root) to the gcc_path. (5) Do a clean build. I had old generated .pb.h files in the source tree, and they were being included rather then the newly generated files that lives in the build-tree. Thanks for your help. Justin On Wednesday, June 20, 2012 6:24:23 AM UTC-7, Evan Jones wrote: On Jun 19, 2012, at 13:53 , Justin Muncaster wrote: 1Running C++ protocol buffer compiler on common/bar/bar.proto 1common/foo/foo.proto: File not found. 1bar.proto: Import common/foo/foo.proto was not found or had errors. I can fix the error by hacking FindProtobuf.cmake and passing in additional include directories, but I run into problems down the line, which leads me to think there must be a better way. Every example I see has all proto files in one folder and does not have cross-library protobuf message dependencies. This should work, and with the project you attached it does work (well, once I fixed a bad field number): Yamnuska:project ej$ protoc --cpp_out=build common/bar/bar.proto Yamnuska:project ej$ I don't know how CMake or this PROTOBUF_GENERATE_CPP rule works, but maybe you need to pass the appropriate --proto_path argument so it looks for the included .proto in the right place? Good luck, Evan -- http://evanjones.ca/ -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/19Xfy9exiscJ. 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.