s11n.net
Saving untold millions of trees... of data.
Project powered by:
SourceForge.net

libs11n 1.2.x

This page covers s11n 1.2. The library can be downloaded from the downloads page, as can the library manual and API docs. Examples of using the library can be found here.

1.2 is architecturally almost identical to 1.0, but it has been restructured and refactored, primarily in the name of having a more portable source tree. It also provides a number of leak guarantees which 1.0 does not correctly impose (and cannot without significant changes).

Main features

  • Provides easy-to-use, easy-to-integrate, and low-maintenance interfaces for serializing a wide variety of C++ types.
  • Serialization support can often be added to types without modifying those types, or them even being aware they are playing along. For example...
  • Out of the box it supports all STL containers (and workalikes), nested arbitrarily deep. By extension, we can (rightfully) assume that...
  • Clients can easily extend it to support their own types using, often non-intrusively.
  • It is data-format agnostic, meaning it doesn't internally care about any file formats. It is container-centric, not stream-centric. The provided i/o layer is just one potential solution to i/o, and the core library can be used with arbitrary client-side i/o mechanisms. The core inherently supports in-memory serialization, not requiring any i/o layer whatsoever (this is useful for serializing over a clipboard-like mechanism and for "casting via serialization").
  • Comes with support for several different file formats, and add-ons can be written to provide further formats (e.g., sqlite3 databases).
  • On some platforms it can dynamically load new data format handlers and Serializable types on-demand from DLLs. This includes Linux and probably most other Unices. Win32 support for plugins is problematic for reasons explained in the Porting Guide.
  • With the exception of the (optional) plugins support, the library uses only ISO-standard C++ constructs, meaning the code is portable to arbitrary modern C++ platforms. That said, it requires a compiler with excellent templates support, including partial template specialization. GCC 3.2+ are believed to be adequate, as is MSVC 2003+.
  • On Unix platforms, it optionally supports client-transparent de/compression from/to zlib- and b2lib-compressed files. (This requires the zfstream utility library.)
  • The library comes with an absurd amount of documentation, in the forms of this web site, API docs, and a large library manual.
  • Comes with s11nconvert, a tool which can convert s11n-saved data between all supported formats.

In no particular order, the significant changes and additions in 1.2, compared to 1.0, include...

Exception handling

The exceptions support has been completely overhauled. Version 1.2 fixes all known potential leaks which (it was realized quite late) could happen during deserialization of, e.g., standard containers holding pointers. Most of the default de/serialization algorithms can now make safety and no-modification guaratees which were previously impossible to make. For client types which have special cleanup needs, it provides an API for client