Questions tagged [cereal]

A C++11 serialization library

cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns them into different representations, such as compact binary encodings, XML, or JSON. cereal was designed to be fast, light-weight, and easy to extend - it has no external dependencies and can be easily bundled with other code or used standalone.

135 questions
2
votes
0 answers

Serializing Data With Cerial And Omitting Type Information

Is it possible to serialize data without serializing the type information? I ask because I'm using Cereal to serialize data into packets and sending them across the network and want to minimize the packet size as much as possible thus not including…
KKlouzal
  • 732
  • 9
  • 32
1
vote
2 answers

Using c++ cereal library, I want to serialize the child, and then the base class. Only base class serialize is getting called

I am using the cereal library. The idea is to have a base class that serializes itself, and the derived class would serialize itself, and the base class. This is an example almost verbatim from the library documentation, but it doesn't work the same…
OOgaBooga
  • 23
  • 4
1
vote
1 answer

Cereal Add Serialize to Existing Library Class

I am trying to add serial support for an existing class in SFML library. I am trying to save colors to be loaded later. From the documents, it says that Cereal is easily extensible to other types, but I have no clue how to do so. Barring creating a…
Collin
  • 73
  • 8
1
vote
1 answer

Serializing and Deserializing in a client-server architecture

I'm using cereal to serialize and deserialize data in c++, and I came upon a problem. I'm sending data using a socket to the client side, so i send a stringstream with the serialized files in a JSON format. The problem is that I can't deserialize it…
Vasile Mihai
  • 103
  • 6
1
vote
0 answers

Cereal polymorhpic hierarchy serialization depth

So I have the following problem. I have an Asset base class. Then I have a Texture class that derives from it and from there I have VulkanTexture, OpenGLTexture and DirectXTexture that all inherit Texture. When serializing a Texture I only need the…
1
vote
0 answers

Serializing vulkan.hpp enumerator with cereal, how do I do it?

The vulan enums in the hpp class use a template wrapper to define bitwise operations to guarantee safety. It looks roughly like this: template class Flags { public: using MaskType = typename…
Makogan
  • 8,208
  • 7
  • 44
  • 112
1
vote
1 answer

C++: How to remove "Cereal" XML node?

I want to (de)serialize C++ object into XML files. To do so, I use Cereal library which is lighter than Boost. So using the Cereal documentation, I created a very simple MWE. Thus, using Cereal serialize function inside the object definition, it is…
R. N
  • 707
  • 11
  • 31
1
vote
1 answer

How to check if something is serializable with cereal

I need trait to check if serialization is possible using cereal. I've already used cereal::traits::is_output_serializable cereal::traits::detail::count_output_serializers (plus the…
Lorah Attkins
  • 5,331
  • 3
  • 29
  • 63
1
vote
1 answer

Serializing a map?

I'm using the cereal library to serialize my classes into files, but am running into trouble with std::map - specifically, maps that use std::filesystem::path. Say I have an Object class that contains only a map, as well as the…
thean
  • 97
  • 9
1
vote
0 answers

Cereal fails on Linux deserializing binaries from Windows

I've been struggling with a Cereal serialization issue for hours. If my struct is serialized on Windows and deserialized on Android it fails with: cereal::Exception: Failed to read 1 bytes from input stream! Read 0" failed if the binary file is…
Pedro Soares
  • 1,117
  • 12
  • 14
1
vote
0 answers

How to serialize struct with member datatype unsigned __int128 (using gcc)

I have been using the cereal c++ library to (de)serialize several structs/classes in my codebase. Following is one such example: struct MnodeInfo { uint64_t node; int prefix_id; MnodeInfo()=default; template void…
PGOnTheGo
  • 805
  • 1
  • 11
  • 25
1
vote
1 answer

cereal::defer and CEREAL_NVP?

I am trying to use the name-value-pairs functionality and the deferred serialization features of Cereal together, but I can't seem to get it to work. It seems that cereal::defer( CEREAL_NVP( vecOfSharedPtrs ) ) works in the save(Archive& ar) const…
whupsilon
  • 11
  • 1
1
vote
0 answers

Serialization of vector of polymorph objects in C++

I am looking for a nice way to serialize a certain class in C++. The main feature of this class is a list/vector/collection of std::shared_ptr, where there can be different subclasses of base_class. So far, I have tried implementing…
carlosvalderrama
  • 465
  • 1
  • 6
  • 22
1
vote
1 answer

boost::container::vector cannot be serialized with Cereal?

I'm trying to serialize a boost::container::vector using Cereal (I know boost provides a serialization library similar to Cereal but the whole project uses Cereal and there is just one corner of it that happens to rely on a boost vector). I…
sunmat
  • 6,976
  • 3
  • 28
  • 44
1
vote
0 answers

Issue with Cereal serialisation shared_ptr

I ran into a problem when serialising shared pointers with Cereal. I have the following class struture: class Source { std::string name; template void serialize(Archive & archive) { archive(name); …
Minee
  • 408
  • 5
  • 12
1 2 3
8 9