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
1
vote
1 answer

Serialization with Cereal for polymorphic class using virtual inheritance

I'm trying to serialize and deserialize a polymorphic class (with virtual inheritance) using Cereal 1.1.2. I get an 'Access violation - no RTTI data!' exception when I try to downcast it to the derived class after deserializing it. It works fine…
adriank
  • 143
  • 11
1
vote
1 answer

C++ Cereal Archive Type Specialization not working

I'm using Cereal 1.1.2 with VS 2013. I've tried the example for archive specialization with types from here: http://uscilab.github.io/cereal/archive_specialization.html But it doesn't compile with the error: error C2665: 'cereal::make_nvp' : none of…
Enhex
  • 118
  • 7
1
vote
1 answer

How can a function modify a parameter passed in by value in C++?

Basically this is a question about semantics. I'm using Cereal library for (de)serialization in C++, and found its coding style interesting: cereal::PortableBinaryInputArchive ar(instream); int out; ar(out); // int is successfully deserialized from…
Isilmë O.
  • 1,668
  • 3
  • 23
  • 35
1
vote
1 answer

Cereal - multiple de-serialization

I am very new to Cereal, and I have a (possible simple) question: Is there a way to deserialize multiple objects when I don't know the number of objects inside the (XML) archive? I tried something like: std::ifstream…
Metallaru
  • 11
  • 1
  • 2
0
votes
2 answers

How to resolve JSON serialization error with cereal c++?

I encountered the following runtime error with cereal when trying serialize the class with JSON: libc++abi: terminating with uncaught exception of type cereal::RapidJSONException: rapidjson internal assertion failure: IsObject() Interestingly,…
drmax
  • 3
  • 2
0
votes
0 answers

Deserializing JSON using cereal

I'm trying to get the cereal serialization library to emit string representations of enums. I'm using the magic_enum library to perform the conversions between the enum and string. While I have no trouble serializing the given MyStruct to a JSON,…
marital_weeping
  • 618
  • 5
  • 18
0
votes
0 answers

C++ Cereal XML-Archive not working with stringstream

I am trying to get cereal-serialization to work. But somehow it does not work with the XML-Archive in combination with a stringstream. Here is my example: std::stringstream ss; cereal::XMLOutputArchive…
0
votes
0 answers

Deserialize json file cereal::JSONInputArchive

I am trying to deserialize json file with Cereal library , the problem is that ifstream is not supported from what I have seen in an issue in github and also tried myself. so this: std::ifstream input("config.json"); cereal::JSONInputArchive…
The Y.c
  • 113
  • 1
  • 8
0
votes
1 answer

Code to store Eigen tensors as binary files

Based on the excellent answers here, I tried to build a method to serialize Eigen tensors. Based on the cereal package I tried the following: namespace cereal { template inline typename…
0
votes
0 answers

Deserializing a templated class

I'd like to be able to recover objects of the templated class A using the deserialize_from_file method below. However, I'd like to not refer to the type of T explicitly as int and double while calling the deserialize_from_file method and rather…
marital_weeping
  • 618
  • 5
  • 18
0
votes
0 answers

Possibility that objects are not the same after serialization/deserialization

(This question is not very clear, maybe not appropriate. I pondered a lot, but in the end, I thought it's better to get any advice than to ask nothing.) I tried to serialize/deserialize a custom struct, using the 'cereal' library, but I found that…
starriet
  • 2,565
  • 22
  • 23
0
votes
0 answers

Cereal C++ error Unresolved External Symbol, cpp hpp issue?

I am new to cpp, coming from Java, so please be patient. I am trying to get the cereal library to work on a very basic test program before I add it into a larger program I am working on for fun. I am trying to serialize to json a Weather object,…
Collin
  • 73
  • 8
0
votes
1 answer

What does 'NVP' mean in the context of C++ / serialization?

The C++ serialization library cereal uses the acronym NVP several times in its documentation without mentioning what it means. A quick web search brings up further hits related to boost serialization, and on first glance I couldn't spot a full…
bluenote10
  • 23,414
  • 14
  • 122
  • 178
0
votes
1 answer

What is happenning in this template header?

There is an amazingly useful answer on how to serialize eigen matrices using cereal: Serializing Eigen::Matrix using Cereal library I copied and verified this code works, but I am having a hard time understanding what is going on in the…
Makogan
  • 8,208
  • 7
  • 44
  • 112
0
votes
1 answer

How do you serialize a derived member class (cereal)

currently I'm trying to serialize a derived class but when I try to serialize it, only the base serialize is called rather than the derived serialization, so when I try to call load the file, the derived member returns a corrupted number. Is there…
Kazuki_ZK
  • 11
  • 3
1 2 3
8 9