Boost serialization with recursion

I have a highly recursive runtime class hierarchy that I want to serialize. Something like:

Ware β†’ Warehouse task β†’ [Workers in transit] β†’ Current path β†’ Current worker β†’ Current transported goods β†’ Warehouse target β†’ ... Where "Warehouse target" may or may not be the same. Thus, a graph can (and does) contain cycles.

Currently using proprietary serialization stuff recursively diving into the graph with "already serialized" detection. However, due to the deep hierarchy, the stack in windows seems small in some cases.

We also wanted to switch to boosting for easier maintenance. How can I make this recursive problem more efficient? Will I have the same problem with boost, how will it try to handle it recursively as before?

What I chose as an alternative is to do a shallow serialization, not serializing the item pointers, but keeping their IDs and putting them in a list for later serialization. Then do them iteratively until nothing is left. This would still mean that we have to fold our own algorithm and for deserialization we will need to store pointers to pointers and update them as soon as we deserialize this object.

+3


source to share





All Articles