OSL is a C++ object serialization library. With it's help the application developer can easily write objects and entire graphs of objects to data storage (I/O streams) without having to write the formatting or data marshalling code normally needed. The application developer adds a bit of code for each class in order to register the class' member fields with the OSL, and at the point in the program code where normally file I/O would be made, the object is passed to one of OSL's serializers to translate the runtime C++ representation into a binary file or XML or other representation.
For the application developer, the great benefits are that the whole I/O process stays object oriented and that all the code that does the data marshalling and/or I/O formatting already exists in the OSL.
The alternatives to the mechanism called serialization are flat binary or text files or SQL databases. All of them requires specialized code for each class or each object model that knows how to convert it into whatever the stored data format is. This normally means the conversion of an object oriented data model that has been designed to suit the purpose of the application into a relationship based or other flat model which can't easily handle references between objects or require a disproportional amount of code to cater for specialized data types.
With a serialization mechanism, the I/O process stays object oriented the whole way. The same data model that was designed to work for the specific application in run time is used for storage as well.
As C++ does not have serialization built in, the programmer must create this ability himself or use a commercially available solution. It is fairly easy to write a very simple serialization mechanism, although it will be very limited in it's capabilities. To come up with a general purpose, platform independent library that can serialize any C++ and STL type is very difficult and there are very few solutions available.
OSL provides a general purpose solution which can handle any standard C++ type, is platform independent, can serialize complex object graphs and has version control of classes.
|Try, 30 Days Free!|
Mac OS X Universal