Need a recommendation for object serialization library in C ++

Am I looking for recommendations for an object serialization / deserialization library in C ++? Which one is the most advanced and open?

Can he handle

  • Any class defined by users?
  • Object hierarchy (parent and child classes)?
  • The tree of objects? Does class A have an attribute of class B that has an attribute of class C?
  • STL containers? Does class A have a vector of class B?
  • The cyclicity of objects? Does class A have a pointer pointing to B, which has a pointer to A?

I find an extended serialization library. I'm not sure what its limitation is from http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/tutorial.html

+4
source share
3 answers

It really depends on what you are looking for. If you're looking for ultra-fast speed and fast-paced library development, Boost is awesome. If you are looking for ultrafast speed, a bit more customizability and binary library compatibility, then Qt is a great solution (not to mention Boost can't be made for this either). If you're looking for crazy interoperability, then find a text-based serialization system like JSON ( jsoncpp ), YAML ( yamlcpp ), or XML (too much), each of which has about 8 billion independent libraries.

+3
source

Protocol buffers are a library developed and used by Google to serialize objects, which is a cross-language. This may differ slightly in concept from what you are describing, but it is worth looking at it.

+3
source

The Linderdaum core (iObject, iStaticClass, and clLinker objects) provides custom RTTI for C ++.

The idea of โ€‹โ€‹serialization is simple there: we use an automated source code post-processor (LSDC) to generate all the save / load and register code for all metaclasses and properties. Any object can be serialized to and from an abstract tree-like markup language script. XML and custom JSON-like (we call it XLML) is supported by the script.

Implementation details are described in this answer: fooobar.com/questions/197147 / ...

  • Any class derived from iObject is supported.
  • Object hierarchies are supported.
  • "Trees" of objects are supported.
  • std :: vector -like containers (support for push_back / size semantics) are supported
  • Well, the properties are explicitly defined, and the "pointer fix" can be done in the iObject :: EndLoad () user method (overridden in user classes).
+1
source

Source: https://habr.com/ru/post/1304639/


All Articles