Trivial Serialization Library
- Dettagli
- Categoria: Projects
- Pubblicato Domenica, 30 Settembre 2012 18:03
- Scritto da Giampiero Gabbiani
- Visite: 5377
Trivial Serialization Library (TSL) is a serialization framework written in C++11.
It cames as part of a major project for which I needed some code in order to save the configurations. Since the libs/projects I found on internet were all - for different reasons - not satisfying me, I wrote [a new] one by myself.
Guidelines
TSL is thought to be easy to learn for simple serialization tasks. Under this point of view the excellent Boost.serialization was a good staring point in both negatives and positives. Trying using it in my code I got the impression of a great library with an efficient design but with a high degree of complexity for the final user (or at least it was difficult for me). The strong template orientation of its design, makes it a perfect example of modern code for solving the serialization problem with C++, but the static polimorphism concept behind it is not exactly what I mean for 'simple', particularly with dynamic plugins, one of my projects pre-reqs. When I realized I was spending too much time in order to understand how to use it, I decided to write a new one.
Given that, many of the concepts introduced in the Boost.serialization library were re-implemented in the TSL too (archive concept and the unique operator '&' for example). The main difference is that the flexibility of the C++ templates for the final user is nevertheless based on dynamic polimorphism through usage of virtual methods, setting the resulting code something in the middle between a pure C++ implementation and the 'traditional' Java behavour.
Features
- Basic Types supported:
- bool
- char
- int8_t
- int16_t
- int32_t
- int64_t
- uint8_t
- uint16_t
- uint32_t
- uint64_t
- float
- double
- std::string
- Variant: through boost::any
- STL containers
- std::map,
- std:vector
- std::list
- Archive implemented:
- JSon
- XML
- binary (big endian)
- escaped character encoding supported in both JSon and XML:
- support to pointers to Serializable objects;
- support for not serializable class;
- support for pure plugin;
- auto-register proxy support for serializable object;
- error management through tsl::ParseError locator exception;
Further description:
Serializing the unserializables...