Dynamic nested messages

33 views
Skip to first unread message

leerho

unread,
May 6, 2020, 2:44:25 PM5/6/20
to Protocol Buffers
I am new to proto buffers but it might be just what I need.  However, I have a couple of special requirements that I can't quite discern from the documentation:
  • In my case the binary field layout is already defined. Think of it as a C struct, with packed primitives: bytes, ints, longs, double, arrays, etc.  Can I use Protobuf to describe that layout and read and write it as well?  To maintain compatibility of existing systems, I cannot have any compression or mangling of the struct layout.
  • Is it possible to have dynamic nested messages?  For example, based on a decoded value of an outer message, the nested message could be of different types with completely different structures.

Adam Cozzette

unread,
May 6, 2020, 4:18:41 PM5/6/20
to leerho, Protocol Buffers
Protobuf uses its own wire format, and unfortunately there is no way to make it conform to another binary format such as C struct layouts.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/37423e34-ef61-4891-a432-40678e0a5c5a%40googlegroups.com.

Derek Perez

unread,
May 6, 2020, 4:24:00 PM5/6/20
to Adam Cozzette, leerho, Protocol Buffers
Wondering if Flatbuffers/Flexbuffers would be a better fit for your requirements?

Reply all
Reply to author
Forward
0 new messages