
Purpose¶
Aims of the project¶
PhoenixSerializer is a C++ library that makes it easy to save, load, serialize and deserialize data. With a single set of generic functions, any supported type can be:
- written to and read from a binary file (
data_save/data_load), - measured to know its size in bytes once serialized (
data_size), - written to and read from a memory message, for example to send it over a network or store it in a buffer (
data_message_save/data_message_load).
The goal is that developers spend their time on their application logic, not on low-level byte handling. Data exchange between applications, or between an application and its storage, should be simple, fast and type-safe.
Key objectives¶
- One function per type: to support a new type, you only specialise one
Serializertemplate. The same code is then used for every operation (file, message, size computation) in both read and write mode, so reading and writing cannot get out of sync. - Standard containers out of the box: simple types (
bool,char, integers, floating point numbers),std::string,std::vector,std::list,std::mapandstd::pairare supported directly, and they can be nested with your own types. - Performance: simple types and contiguous containers of simple types are copied as raw blocks of memory, without any per-element overhead.
- Simple data format: data are stored as they are, with no extra metadata, so the format stays compact and easy to understand (see Data format).
- Enumerations: the
PHOENIX_DATA_STREAM_ENUMmacro declares the serialization of anenumin one line. - Code generation: with PhoenixFileGenerator, classes and their serialization functions can be generated from a short description (see Code generation).
- Easy integration: the library is built with CMake, packaged with
pixiand available on the phoenix conda channel, so it can be added to other projects with little effort.
Scope¶
PhoenixSerializer focuses on turning C++ data into bytes and back. Some topics are deliberately left to other libraries of the PHOENIX ecosystem:
- endianness is handled by PhoenixEndianess,
PStringandPPathare not serialized by this library.
Installation¶
Instructions are available in the installation section.
Quick Start¶
Please have a look at the quick start documentation.
Contributing¶
Contributing is much appreciated! Guidelines are available here.
License¶
PhoenixSerializer is distributed under the 'LGPL-3.0-only' license.
Citation¶
Please cite the exact version of PhoenixSerializer you have used with the corresponding DOI on zenodo.
Contact¶
Maintainers and authors are listed in the pixi.toml manifest, along with the source code publicly available.