s11n.net
Bringing serialization into the 21st century... bit by bit.
Project powered by:
SourceForge.net

s11n 1.2.x examples

This page demonstrates some sample client apps. These sources are all available in the s11n source tree, under src/client/sample/. The source tree contains many more examples than we will post here.

One thing to keep in mind about these examples is that the data format of their output is irrelevant. Here we will use various formats, but for s11n purposes they can all be treated the same.

STL maps:

The source file sdj2.cpp demonstrates how to save and load a std::map type. It generates this output.

Saving your genetic data:

Here we take non-s11nable client code (gene.hpp) make it serializable (gene_s11n.hpp), and then demonstrate it (gene.cpp). Its output looks like this.

Static or global data:

This example, statics.cpp, demonstrates one approach to serializing static or global data. Don't be put off by the length of this example - half of it is comments. The output is here.