title: How to save and load a C++ application state in a modular way
body: <p>I have a distributed C++ application, which is composed of 4 processes spread on 2 machines. One of the applications serves as "control center" for the rest of the applications. </p>
  
  <p>I want to be able to save the current state to a file and load it again later. What exactly is a "state" is defined separately by each module in the system. When saving, the modules states should be combined to one file. When loading, each module should read the state data back from the file.</p>
  
  <p>The state has to be saved to a human-readable text file, as it is going to be edited by some users. So a binary file format is not an option. In addition, a standard file format such as XML or YAML is preferred.</p>
  
  <p>How would you recommend implement a basic framework for state saving/loading as I just described? I prefer to do the minimum data serialization work needed for this task. Also, the framework should allow to easily add more data to be saved in the future.</p>