cereal

Cereal serialization error

拈花ヽ惹草 提交于 2020-08-06 21:25:47
问题 So i'm legit confused. It won't compile for an external serialization function. It gives the error cereal could not find any output serialization functions for the provided type and archive combination. So the code below doesn't compile #include <fstream> #include <glm/glm.hpp> #include "SceneObject.h" #include <cereal/cereal.hpp> #include <cereal/archives/json.hpp> template<typename Archive> void serialize(Archive& archive, glm::vec3& v3) { archive(cereal::make_nvp("x", v3.x), cereal::make

Cereal serialization error

穿精又带淫゛_ 提交于 2020-08-06 21:22:50
问题 So i'm legit confused. It won't compile for an external serialization function. It gives the error cereal could not find any output serialization functions for the provided type and archive combination. So the code below doesn't compile #include <fstream> #include <glm/glm.hpp> #include "SceneObject.h" #include <cereal/cereal.hpp> #include <cereal/archives/json.hpp> template<typename Archive> void serialize(Archive& archive, glm::vec3& v3) { archive(cereal::make_nvp("x", v3.x), cereal::make

How to detect if a type is shared_ptr at compile time

杀马特。学长 韩版系。学妹 提交于 2020-08-02 04:04:45
问题 I want to get a templatized way of finding if a type is a shared_ptr and based on that I want to have a new specialization of a function. Example main function is, template <class T> inline void CEREAL_LOAD_FUNCTION_NAME( RelaxedJSONInputArchive & ar, NameValuePair<T> & t ) { std::cout << " CEREAL_LOAD_FUNCTION_NAME NameValuePair 1 " << std::endl; ar.setNextName( t.name ); ar( t.value ); } If t.value is shared_ptr then I want to have a different function specialization. I have tried below,

Do cereal and Boost Serialization use zero-copy?

人盡茶涼 提交于 2020-07-05 05:36:23
问题 I have done some performance comparison between several serialization protocols, including FlatBuffers, Cap'n Proto, Boost serialization and cereal. All the tests are written in C++. I know that FlatBuffers and Cap'n Proto use zero-copy. With zero-copy, serialization time is null but size of serialized objects is bigger. I thought that cereal and Boost serialization didn't use zero-copy. However, serialization time (for int and double) is nearly null, and size of serialized objects is nearly

Do cereal and Boost Serialization use zero-copy?

做~自己de王妃 提交于 2020-07-05 05:36:05
问题 I have done some performance comparison between several serialization protocols, including FlatBuffers, Cap'n Proto, Boost serialization and cereal. All the tests are written in C++. I know that FlatBuffers and Cap'n Proto use zero-copy. With zero-copy, serialization time is null but size of serialized objects is bigger. I thought that cereal and Boost serialization didn't use zero-copy. However, serialization time (for int and double) is nearly null, and size of serialized objects is nearly

Serializing Eigen::Matrix using Cereal library

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-01 04:26:45
问题 UPDATED : I managed to get it to work after I googled around and read the doxygen comments in code. Problem was that I missed the cast before using resize() method and also not using std::ios::binary for the streams. If you want to do something similar, better check the answer by Azoth. I am trying to serialize Eigen::Matrix type using Cereal. This is what I have (loosely based on https://gist.github.com/mtao/5798888 and the the types in cereal/types ): #include <cereal/cereal.hpp> #include

Examples of using cereal serialization and boost::asio?

孤者浪人 提交于 2019-12-25 12:14:19
问题 I'm trying to serialize objects/messages and send them as UDP packets between nodes. I'm currently looking at cereal for serialization and boost::asio for actual network programming. Are there any examples of using these two libraries together, even if it's pseudocode? 回答1: You can treat any example of Boost Serialization with Asio as the pseudo code example. Despite some differences, Cereal is similar enough to Boost Serialization for the samples to be relevant. Straight forward: sending

Examples of using cereal serialization and boost::asio?

折月煮酒 提交于 2019-12-25 12:14:03
问题 I'm trying to serialize objects/messages and send them as UDP packets between nodes. I'm currently looking at cereal for serialization and boost::asio for actual network programming. Are there any examples of using these two libraries together, even if it's pseudocode? 回答1: You can treat any example of Boost Serialization with Asio as the pseudo code example. Despite some differences, Cereal is similar enough to Boost Serialization for the samples to be relevant. Straight forward: sending

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

我的未来我决定 提交于 2019-12-22 10:46:50
问题 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 os(&buf); boost::archive::binary_oarchive oa(os); printf("Buffer size %d\n",(int)buf.size()); The output of 32bit machine is 37 and the output of 64bit machine is 41 . Is there any other good serialize library I can Use? How about cereal ? It's great if the library can do

Is there a way to specify a simpler JSON (de-)serialization for std::map using Cereal / C++?

萝らか妹 提交于 2019-12-04 19:19:09
问题 The project I'm working on is a C++ application that manages a large number of custom hardware devices. The app has a socket/port interface for the client (like a GUI). Each device type has its own well-defined JSON schema and we can serialize those with Cereal just fine. But the app also needs to parse inbound JSON requests from the client. One portion of the request specifies device filter parameters, roughly analogous to a SQL 'WHERE' clause in which all the expressions are ANDed together.