boost-serialization

assertion_failed when using Boost Serialization with xml_oarchive

六月ゝ 毕业季﹏ 提交于 2019-12-07 06:24:38
问题 When compiling a simple test of Boost Serialization: class Test { protected: int Num; friend class boost::serialization::access; template <class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_NVP(Num); } public: Test(): Num(0) {} ~Test() {} }; using an xml_oarchive for output, I am experiencing the following GCC error: C:\Development\Libraries\boost_1_55_0\boost\mpl\assert.hpp|289|error: no matching function for call to 'assertion_failed(mpl_:

serializing Eigen's Matrix using boost.serialization

↘锁芯ラ 提交于 2019-12-07 05:40:38
问题 I'm trying to serialize Eigen's matrix. So that I can serialize a more complex object. I'm using Matrix as a base class and include the serialization in the derived class. I'm confused on how to address Matrix.data(), which returns a c-style array (if i'm correct). This is my attempt: #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> template < class TEigenMatrix> class VariableType : public TEigenMatrix { private: friend class boost::serialization::access;

Extending boost serialization

百般思念 提交于 2019-12-07 05:25:51
问题 I'm attempting to setup multi-purpose serialization for a networked video game for mobile devices. Because it's networked, during initial connection I need to serialize all data for the game state, however, once a game is in progress I will only need to serialize certain changes. The save and load methods that are part of the boost serialization library only have a version number as an parameter. What I'd like to be able to do is have more parameters so that I can change the conditions for

Boost serialization of reference member abstract class

那年仲夏 提交于 2019-12-07 02:44:30
I'm trying to figure out how to serialize a class that I put together with Boost. I'll get right to the code: #ifndef TEST_H_ #define TEST_H_ #include <iostream> #include <boost/serialization/serialization.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_iarchive.hpp> class Parent { public: int test_val = 1234234; int p() { return 13294; } int get_test_val() { std::cout << test_val << std::endl; return test_val; } friend class boost::serialization::access; template<class Archive> void serialize(Archive &ar, const unsigned int /*version*/) { ar &test_val; } };

Serialization using Boost.Serialization

血红的双手。 提交于 2019-12-06 23:59:16
问题 I have been trying serialization but every time I got stuck with errors like:- error: 'class std::vector<int, std::allocator<int> >' has no member named 'serialize' here is my source code and serialize method ,knowing I am use boost.serialize template <class E, class T> class heap{ vector<E> * hp; int index;//index is pointing to first empty place after the last element int maxsize; T comp;//comparable object designed to compare the objects private: friend class boost::serialization::access;

How do I serialize a class containing pointers to primitives?

╄→гoц情女王★ 提交于 2019-12-06 22:01:30
I am trying to use boost's functionality for serializing pointers to primitives (so that I don't have to de-reference and do a deep store myself). However, I get a pile of errors when I try to do it. Here is a simple example of a class that is supposed to contain save and load methods which write and read the class content from a file. This program does not compile: #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/shared_ptr.hpp> #include <boost/shared_ptr.hpp> #include <fstream> class A { public: boost::shared_ptr<int> sp; int

boost serialization of stl collection of std unique_ptrs

大城市里の小女人 提交于 2019-12-06 06:02:23
问题 I'd like to be able to serialize stl container of std::unique_ptrs. Can it be done? btw, everything works fine with single std::unique_ptr. Below is the code I'm working on, and the gcc gives the folowing error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = MyDegrees; _Dp = std::default_delete<MyDegrees>; std::unique_ptr<_Tp, _Dp> = std::unique_ptr<MyDegrees>]’ How can I make the code to work? #include <iostream> #include <memory>

Boost Polygon Serialization

走远了吗. 提交于 2019-12-05 18:03:35
I am using boost geometry in my project, and I need to serialize polygons. I have been using boost serialization without problems for many boost data types, but boost geometry seems that currently does not support serialization, as I cannot find any header inside serialization folder. Is there any well known method to achieve this? Thanks. EDIT: Binary Serialization Example in: Boost Polygon Serialization: Ring I agree, it is weird that Boost.Geometry does not support Boost.Serialization. Probably it is hard to support all possible combinations of template parameters, or maybe they did not

Follow up: Boost serialized custom C++ object passed over ZeroMQ pull socket

故事扮演 提交于 2019-12-05 13:07:01
This is a follow up problem that I opened up earlier in another thread at Boost: De-serializing a custom C++ object passed over ZeroMQ pull socket . The problem in that thread has been resolved based on the answer provided. Now I have another problem at runtime. Please, see the below description. I am realtively new to C++ realm so I appreciate if you tell me any necessity for improvement in any part of the code provided in addition to what I descibed under problem statment. Description: I have a C++ class named GenericMessage which simply holds an id and data as its members (See code snippet

Extending boost serialization

房东的猫 提交于 2019-12-05 09:45:37
I'm attempting to setup multi-purpose serialization for a networked video game for mobile devices. Because it's networked, during initial connection I need to serialize all data for the game state, however, once a game is in progress I will only need to serialize certain changes. The save and load methods that are part of the boost serialization library only have a version number as an parameter. What I'd like to be able to do is have more parameters so that I can change the conditions for what gets saved and loaded based on more than just a version number. Boost serialization docs are here,