boost-serialization

boost::serialization with mutable members

Using boost::serialization, what's the "best" way to serialize an object that contains cached, derived values in mutable members, such that cached members aren't serialized, but on deserialization, they are initialized the their appropriate default. A definition of "best" follows later, but first an example: class Example { public: ...

C++ Serialization Clean XML Similar to XSTREAM

I need to write a linux c++ app which saves it settings in XML format (for easy hand editing) and also communicates with existing apps through XML messages over sockets and HTTP. Problem is that I haven't been able to find any intelligent libs to help me, I don't particular feel like writing DOM or SAX code just to write and read some ve...

Boost Serialization Library upgrade

Hello! How do I know that I can safely upgrade Boost Serialization Library on a production system without breaking compatibility with the existing data ? Is there any test that I should perform in order to be sure that all data stored in the binary format by previous version of the library will be successfully read by the new one ? Does...

Using Boost.Serialization to parse a custom XML format

Hello, I have a custom XML format that needs to be serialized to objects. I only need to serialize certain tags and ignore the rest. I have the impression that I need to write my own archive class but there is no documentation that explains how can it be done. I do not need to save anything, just load the initial state of the object. Any...

Serializing a map of objects to xml using boost::serialization

The serialization example below is from the boost mailing list which is pretty much the same as what I would like to do. However, I have changed the archive so that it will serialize to XML. The compile does not fail if I serialize to binary, but it fails when serializing to xml. The compile fails in basic_xml_oarchive.hpp in the followi...

Serialization tree structure using boost::serialization

I have to serialize libkdtree++ in my program, the tree structures are briefly described as following: struct _Node_base { _Node_base * _M_parent, *_M_left, * _M_right; template<Archive> serialize(Archive &ar, const unsigned int version) { ar & _M_left & _M_right; } } template<typename V> struct _Node : public _Node_base {...

Where to put BOOST_CLASS_EXPORT for boost::serialization?

I'm trying to serialize a pointer to a polymorphic class Shape. So I need to use the BOOST_CLASS_EXPORT macro to define a GUID for each subclass. The problem: where to put it? Let me show a minimal test case first: shapes.hpp #include <boost/serialization/access.hpp> #include <boost/serialization/base_object.hpp> #include <boost/seria...

Serialize to XML using boost::serialization

Hi, This is a newbie question. I am trying to serialize some objects to XML, but the resulting XML contains a boost serialization signature, version information, class id, ...etc. that I do not need. Is there a way to get rid of them without post-processing the xml message? #include <fstream> #include <iostream> #include <boost/archive...

Serialize stdext::hash_map using boost serialization library

I want to serialize a hash map to a file and de-serialize it later on. #include <boost/serialization/hash_map.hpp> #include <boost/filesystem/fstream.hpp> #include <hash_map> class A: virtual public B { public: friend class boost::serialization::access; stdext::hash_map<std::string, myClass> myClassHashTable; template ...

Does Boost.Serialization serialize differently on different platforms?

I use Boost.Serialization to serialize a std::map. The code looks like this void Dictionary::serialize(std::string & buffer) { try { std::stringstream ss; boost::archive::binary_oarchive archive(ss); archive << dict_; buffer = ss.str(); } catch (const std::exception & ex) { throw DictionaryException(ex.what()); ...

boost.serialization - free version and base class implementation.

I have a "generator" class that basically constructs its subclass. To use this thing I simply subclass it and pass it the correct parameters to build the object I want built. I want to serialize these things and there's no good reason to do it for each subclass since all the data is in the base. Here's what I've got as example: #incl...

Help compiling and using boost c++ libraries

I am working on a C++ project where I'd like to use boost's serialization libraries. I downloaded and installed the latest boost libraries from boost's home page. When I tried to compile and run the one of boost's demo serialization examples, I got all sorts of errors that looked like this: /usr/local/include/boost/archive/detail/...

Is it possible to use boost::serialization with managed class?

We have a lot of native c++ classes that are serialized perfectly using boost::serialization. Now we want to change some of their member fields to property, so we could use them in PropertyGrids. When we changed the class definiction to ref class X, we got a huge number of these compilation errors: #1: error C2893: Failed to specialize...