boost-serialization

boost serialization vs google protocol buffers? [closed]

给你一囗甜甜゛ 提交于 2019-12-02 15:42:33
Does anyone with experience with these libraries have any comment on which one they preferred? Were there any performance differences or difficulties in using? Magnus Österlind I've played around a little with both systems, nothing serious, just some simple hackish stuff, but I felt that there's a real difference in how you're supposed to use the libraries. With boost::serialization, you write your own structs/classes first, and then add the archiving methods, but you're still left with some pretty "slim" classes, that can be used as data members, inherited, whatever. With protocol buffers,

Boost: De-serializing a custom C++ object passed over ZeroMQ pull socket

杀马特。学长 韩版系。学妹 提交于 2019-12-02 14:51:11
问题 The text I am writing here is a follow up problem that I opened up earlier in another thread at Boost: Serializing/De-serializing a custom C++ object passed over ZeroMQ pull socket. The compilation problems in the earlier thread have been resolved by using a textarchive type rather than binaryarchive but now I experience a runtime problem when de-serializing. I repeat the earlier text here with a new problem statement for your convenience. I am relatively new to C++ realm and appreciate any

Boost Serialization of vector<char>

帅比萌擦擦* 提交于 2019-12-02 10:02:03
问题 Does serializing a binary sequence stored in vector cost much? For example if I am using binary archive. Will the boost::serialization library put characters to differentiate char elements of vector and make the output larger? 回答1: Measure it! The sort answers: No it doesn't cost much. Profile it (and see whether it fits your application) No, vector elements will not be differentiated for vectors of POD types. (Things change when you serialize vectors containing pointers to polymorphic

Boost Serialization Segfault

依然范特西╮ 提交于 2019-12-02 08:39:40
问题 I am trying to serialize a class member. The following snippet of code will show the relevant class definitions and the non-intrusive serialization code I have included. I am getting a segfault during my saveHashTable() method which tries to serialize the class member shash_table_. Here is a self-contained trimmed version of the code: #include <map> #include <string> #include <vector> #include <set> #include <fstream> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text

Boost Serialization of vector<char>

北慕城南 提交于 2019-12-02 07:10:10
Does serializing a binary sequence stored in vector cost much? For example if I am using binary archive. Will the boost::serialization library put characters to differentiate char elements of vector and make the output larger? sehe Measure it! The sort answers: No it doesn't cost much. Profile it (and see whether it fits your application) No, vector elements will not be differentiated for vectors of POD types. (Things change when you serialize vectors containing pointers to polymorphic classes. This is obvious, since it couldn't be done more efficiently unless you have extra knowledge about

Deserializing constructor hierarchy

久未见 提交于 2019-12-02 06:56:49
(This question is very similar to this one , but this time I am calling the Parent deserializing constructor in the Child initialization list). In a case where a Child adds no new data to be serialized, the Parent does not have a default constructor, I want to be able to serialize the Parent object directly as well as the Child , and neither the child nor the parent have default constructors, it seems like we should use the following pattern, where the child deserializing constructor initializes the parent (also using its deserializing constructor) in the initialization list: #include <boost

Boost: De-serializing a custom C++ object passed over ZeroMQ pull socket

穿精又带淫゛_ 提交于 2019-12-02 05:58:47
The text I am writing here is a follow up problem that I opened up earlier in another thread at Boost: Serializing/De-serializing a custom C++ object passed over ZeroMQ pull socket . The compilation problems in the earlier thread have been resolved by using a textarchive type rather than binaryarchive but now I experience a runtime problem when de-serializing. I repeat the earlier text here with a new problem statement for your convenience. I am relatively new to C++ realm and appreciate any further help. Description: I have a C++ class named GenericMessage which simply holds an id and data as

Boost Serialization Segfault

夙愿已清 提交于 2019-12-02 04:14:49
I am trying to serialize a class member. The following snippet of code will show the relevant class definitions and the non-intrusive serialization code I have included. I am getting a segfault during my saveHashTable() method which tries to serialize the class member shash_table_. Here is a self-contained trimmed version of the code: #include <map> #include <string> #include <vector> #include <set> #include <fstream> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/vector.hpp> #include <boost/serialization/set.hpp> #include

Common confusions with serializing polymorphic types

我与影子孤独终老i 提交于 2019-12-01 23:23:17
问题 I have seen many questions, tutorials, and documentation involving serializing derived classes, and I haven't been able to reach a consensus on several issues, including (and illustrated in the following code): boost::serialization::base_object vs BOOST_SERIALIZATION_BASE_OBJECT_NVP archive & mData; vs archive & BOOST_SERIALIZATION_NVP(mData); The usefulness of BOOST_SERIALIZATION_ASSUME_ABSTRACT(AbstractPoint); Requiring serialize() for a class in the hierarchy that doesn't need to serialize

Serialization example of boost/archive/binary_woarchive.hpp and/or boost/archive/binary_wiarchive.hpp?

孤街醉人 提交于 2019-12-01 21:54:55
I'm trying to find a good example of how to use these binary wide character versions of boost's serialization stuff. I pieced together some code to try and get it working, but unfortunately I get bombarded with linker errors when trying to compile it. Here's my code, in case I'm doing anything obviously wrong: #include <cstdlib> #include <iostream> #include <fstream> #include <string> #include <vector> #include <boost/archive/binary_woarchive.hpp> #include <boost/archive/binary_wiarchive.hpp> class testClass { public: testClass() { } testClass(const int intInput, const std::wstring stringInput