How to save c++ object into a xml file and restore back?
Boost's serialization library might be implementing a lot of the functionality you are looking for.