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
4
votes
1 answer

"auto" deducing incorrect type in hashtable_policy.h

I'm building a pair of tools, gridlab-d and HELICS, the prior of which uses the latter's shared libraries. When compiling gridlab-d after successfully building/installing HELICS, I get the following errors: In file included from…
ESilk
  • 282
  • 3
  • 14
4
votes
1 answer

Using Cereal to deserialize a JSON string

I am new to Cereal and I am having a hard time understanding how to deserialize a JSON string. Unfortunately, my work firewall restricts me from accessing Google Groups to post on the message board. I have a class that I can turn into a JSON string…
A.Webb
  • 47
  • 1
  • 5
4
votes
1 answer

How can I know the size of Cereal's binary output?

I'm trying to transmit Cereal's serialization result (binary archive) via a TCP link. For the receiving side the first thing is to decide how many bytes (at least) are needed to recover the message object, but seems there is no way to get this…
Danath
  • 91
  • 7
4
votes
0 answers

after changing to XML "cereal could not find any output serialization functions"

I want to serialize a Reconstruction class in a library called theia. The class Reconstruction does have a serialize function: friend class cereal::access; template void serialize(Archive& ar) { // NOLINT ar(next_track_id_, …
Llopeth
  • 406
  • 5
  • 11
4
votes
3 answers

Boost serialization does not work between 32bit and 64bit machine. Any other serialization / compression library?

I am trying to use the boost library to serialize on 64bit machine and de-serialize on 32bit machine. However, it seems it does not work. (I use 1.57.0). If I run the following code boost::asio::streambuf buf; std::ostream…
venusisle
  • 113
  • 2
  • 10
3
votes
1 answer

C++11 Cereal Serialization - versioning

I have successfully serialized two members of my class. archive( cereal::make_nvp("width", m_width), cereal::make_nvp("height", m_height), ); Now, in a later version my code contains more members and I would like to archive…
Simon
  • 706
  • 6
  • 23
3
votes
0 answers

Cereal seems to be picky about base classes that are never serialized

A contrived (minimal) example that I reduced. Step #1 is to have a base type with an enumerated 'kind' field that must be populated by the derived constructors. Note that there is no reason to have a serializer for BodyPart, since the non-default…
user566408
  • 57
  • 5
3
votes
2 answers

Cereal/C++ 11 - How to specify optional parameters for de-serialization

I've got class which is de-serialized with standard function: template // public serialization (normal) void serialize(Archive & ar) { ar( cereal::make_nvp("parameter_1", parameter_1), cereal::make_nvp("parameter_2",…
StefanB
  • 31
  • 3
3
votes
3 answers

C++ CMake compilation error (/usr/bin/ld: cannot find )

*I know there are lots of questions about this, but they simply don't help much when talking about CMake, hence my decision of making the question * So I was working on CLion which uses CMake in order to import and give parameters to the compiler,…
BlindHouse
  • 111
  • 1
  • 3
  • 10
3
votes
2 answers

How to serialize a boost::uuid with cereal

Trying to serialize this simple class: class Data { public: Data(); Data(boost::uuids::uuid id); Data(const Data&) = delete; Data& operator=(const Data&) = delete; inline boost::uuids::uuid getGuid() { return guid; } …
kittikun
  • 1,829
  • 1
  • 25
  • 33
3
votes
1 answer

Sending a StringStream of Binary Data from Cereal with ENet

I have been working on wrapping ENet into a set of easy to use functions for a few weeks now and seem to have a bit of an issue. I have a std::stringstream and am attempting to send the contents to a remote machine using ENet then reconstruct the…
KKlouzal
  • 732
  • 9
  • 32
3
votes
1 answer

C++11 Cereal Library Cannot Serialize A Class Of Mine

I am using the cereal library and am trying to get a shared_ptr instance of a derived type with a custom constructor to be fed into an archive correctly. I've poured over the following documentation but am clearly missing something. Here are the…
M2tM
  • 4,415
  • 1
  • 34
  • 43
2
votes
1 answer

Cereal - unable to deserialize a json string - unhandled exception

This is my json string { "connectionString" : "MyConnectionString", "value" :"MyVal" } This is my class struct Settings { std::string connectionString; std::string value; template
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
2
votes
0 answers

How to list serialization functions found by Cereal

Context: I'm hitting this assertion while compiling an existing (big) code: /usr/include/cereal/cereal.hpp:833:9: error: static assertion failed: cereal found more than one compatible input serialization function for the provided type and archive…
Vitor
  • 2,734
  • 29
  • 40
2
votes
1 answer

Can Protobuf's oneof deserialization functionality be recreated using Cereal?

I am able to write code to deserialize a proto message that contains a oneof section without having to know beforehand what the oneof section contains. I can not figure out how to write a similar set of struct definitions that I can deserialize the…
Evan
  • 53
  • 10
1
2
3
8 9