Questions tagged [boost-serialization]

Boost.Serialization is a cross-platform C++ serialization library.

Boost.Serialization is a cross-platform C++ serialization library. Here, we use the term "serialization" to mean the reversible deconstruction of an arbitrary set of C++ data structures to a sequence of bytes. Such a system can be used to reconstitute an equivalent structure in another program context. Depending on the context, this might be used to implement object persistence, remote parameter passing or other facility. In this system we use the term "archive" to refer to a specific rendering of this stream of bytes. This could be a file of binary data, text data, XML, or some other created by the user of this library.

Boost.Serialization goals:

  1. Code portability - depend only on ANSI C++ facilities.
  2. Code economy - exploit features of C++ such as RTTI, templates, and multiple inheritance, etc. where appropriate to make code shorter and simpler to use.
  3. Independent versioning for each class definition. That is, when a class definition changed, older files can still be imported to the new version of the class.
  4. Deep pointer save and restore. That is, save and restore of pointers saves and restores the data pointed to.
  5. Proper restoration of pointers to shared data.
  6. Serialization of STL containers and other commonly used templates.
  7. Data Portability - Streams of bytes created on one platform should be readable on any other.
  8. Orthogonal specification of class serialization and archive format. That is, any file format should be able to store serialization of any arbitrary set of C++ data structures without having to alter the serialization of any class.
  9. Non-intrusive. Permit serialization to be applied to unaltered classes. That is, don't require that classes to be serialized be derived from a specific base class or implement specified member functions. This is necessary to easily permit serialization to be applied to classes from class libraries that we cannot or don't want to have to alter.
  10. The archive interface must be simple enough to easily permit creation of a new type of archive.
  11. The archive interface must be rich enough to permit the creation of an archive that presents serialized data as XML in a useful manner.
448 questions
0
votes
1 answer

Find correct Boost version installed and how to remove the old version

I had boost previously installed by sudo apt-get libboost-dev sudo apt-get libboost-all-dev and I think I got boost 1.58. Then I needed the latest boost for boost_serialization, for that I tried installing boost by downloading from here, and then…
AwaitedOne
  • 992
  • 3
  • 19
  • 42
0
votes
1 answer

Using boost serialization to convert class object to vector

I am referring this : https://theboostcpplibraries.com/boost.serialization-class-hierarchies I want to serialize object of my class, to std::vector class Person { int id; std::string name; } And then deserialize back to that…
user17836
  • 103
  • 1
  • 7
0
votes
2 answers

Why make_nvp needs non-const reference?

Why non-const reference here? template const nvp< T > make_nvp(const char * name, T & t); The reason i'm asking is that i have a structure with public fields and i need to make them private and use accessors instead. So i would like to…
Yola
  • 18,496
  • 11
  • 65
  • 106
0
votes
0 answers

fatal error LNK1104: cannot open file 'boost_serialization.lib'

I made a Qt application using boost serialization that builds perfectly on MacOS and Linux. Now I'm trying to build it on Windows using MSVC 2010. I'm using Qt5.5.0 msvc2010, boost 1.55.0 msvc2010 binaries downloaded from sourceforge. The…
paperox
  • 11
  • 1
  • 4
0
votes
0 answers

Boost Serialization invoke wrong serialization method

I have used the macro pair of BOOST_CLASS_EXPORT_KEY(T) for header file and BOOST_CLASS_EXPORT_IMPLEMENT(T) for implementation file in order to serialize derived class from base class pointer. (**note: I have put the macro in all headers and…
vincent911001
  • 523
  • 1
  • 6
  • 20
0
votes
1 answer

How to save an actual address stored in the pointer

Is it possible to save an actual address stored in the pointer instead of the object that it points to? I mean, boost::serialization automatically serializes the object referenced by a and not the address of the object but in my case there are a lot…
FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
0
votes
2 answers

Serializing std::multiplies using Boost

I am trying to serialize the following user-defined object: ConcatConstMapping >* obj; Boost shows me the following error: > /usr/include/boost/serialization/access.hpp:118:9: error: ‘struct > std::multiplies’ has no…
ManiAm
  • 1,759
  • 5
  • 24
  • 43
0
votes
1 answer

Writing a map to xml using boost

i have writing a map to an xml file using the below code , but i can't successfully compile the code , i am actually trying to compile this on mac sierras terminal . Would you please advice what may have went wrong #include #include…
LearningCpp
  • 972
  • 12
  • 29
0
votes
0 answers

How to read and write a map of string and a structure to a file

The task I tried to accomplish was a set of strings which have to be stored into a std::set and then save it to a file with a number assigned to each set. and I managed to accomplish it by below code using some boost functions void WriteToFile() { …
LearningCpp
  • 972
  • 12
  • 29
0
votes
1 answer

boost::serialization polymorphic type initialization

I have a base class and 4 derived classes. I store all my derived classes in a vector of base class pointer type. During first initialization I create each derived type differently using their constructors. Basically they each have different param…
mentat
  • 2,748
  • 1
  • 21
  • 40
0
votes
0 answers

Boost serialization of derived object does not call derived serialize()

I have a template class Field that derives from IField. This makes it possible to add any specific Field like Field and Field to a std::vector. In the Model-class I'm serializing this vector. I can compile everything, but I'm…
Akinna
  • 61
  • 10
0
votes
2 answers

Boost serialization with pointers

The data structure I would like to serialize is mostly a list of objects. An object may have a pointer to another. Serialization then fails with a pointer…
SpamBot
  • 1,438
  • 11
  • 28
0
votes
1 answer

Boost::serialization and base/derived relationship not registered

I have 2 polymorphic types that are derived from like so: class Base1 {...}; class Base2 {...}; class Derived1 : public Base1 {...}; class Derived : public Derived1, public Base2 {}; I use BOOST_CLASS_EXPORT_KEY(Derived) in the serialization…
MMM
  • 910
  • 1
  • 9
  • 25
0
votes
0 answers

boost::binary_wiarchive gives linking error

I'm using: Visual studio 2013 Update 5; Boost 1.57.0; built using boost site documentation except that for address-model=64 flag (I need to create 64bit applications). I've created a new project for testing serialization. This code compile just…
Jepessen
  • 11,744
  • 14
  • 82
  • 149
0
votes
1 answer

Register a type with no default constructor

I am trying to serialize a derived class that does not have a default constructor. I am using the deserializing constructor pattern. I've read that you have to register the type of a derived class, so I am doing that in the output archive…
David Doria
  • 9,873
  • 17
  • 85
  • 147