Ball provides support for the serialization and deserialization of objects and their platform-independent storage.
All persistent objects have to be derived from PersistentObject. The management, serialization, and deserialization is performed by the PersistenceManager class. A persistence manager possess an input stream and an output stream ( persistent streams ). It can write objects to the output stream, thereby converting them to a portable format and serializing all dependend objects, too. It can also read objects from the input stream, create the corresponding objects dynamically and demangle pointers and references.
There are two main problems related with this trivial persistence concept:
multiple inheritence from a single base class
static members variables These problems are inherent problems of C++ and cannot be solved. However, they can be avoided in most cases. To circumvent problems related to multiple instances of a common base class (which would normally require virtual inheritence - but this does not solve the problem), we introduced the model storable . Storable objects are not derived from PersistentObject, but they provide two functions (read/write) to write themselves to a persistent stream and to retrieve their contents again.
Static member variables should usually be ignored when reading/writing persistent objects. However, this has to be decided on a case-by-case basis.