Search code examples
c++apacheprotocol-buffersthrift-protocol

Recursive data structures in Protocol Buffers, Apache Thrift or any other Data structure serialization protocol?


I have enough theoretical knowledge about the Protocol Buffers, Apache Thrift and about other Data Structure serialization protocols. My questionis that if i need to define a recursive data structure(Linked Lists, Search Trees etc..) or some relationship between different objects, is there any built in standard way Protocol Buffers or Apache Thrift provides to set a link between different structures (we use pointers in normal programming practice)? or we have to continue like using pointers to make a link between different Data structure objects ?

I want to do it with C++ API

Thank you in Advance! :)


Solution

  • Both allow a message of type X to contain other messages of type X, neither allows a message to contain itself (unlike, say, Java serialisation). Doing otherwise would be very expensive for an unusual case.

    But don't send your actual data model over either; instead work out your own efficient wire representation and use the serialisation protocol to transport it.