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

Deserializing STL container of type with no default constructor

I've recently learned the pattern of the deserializing constructor (Deserializing constructor doesn't read data correctly) to use serialization with types that do not have default constructors. Now I'm trying to serialize an STL container of these…
David Doria
  • 9,873
  • 17
  • 85
  • 147
0
votes
0 answers

Disallow serializing an object directly (not through a pointer) if it doesn't have a default constructor

I have recently been using save_construct_data() and load_construct_data() when I need to serialize an object without a default constructor. Since it doesn't make sense to do: MyObject a; // can't do this because there is no default…
David Doria
  • 9,873
  • 17
  • 85
  • 147
0
votes
1 answer

Can't use boost::stream with std::string to instanciate boost::binary_oarchive or boost::binary_iarchive

Cheer developer, i have got trouble with the next code (visual studio 2015 compiler): template inline void Serialize::IntoStringBuffer(const SERIALIZABLE_TYPE& object, BUFFER_TYPE& strBuffer) { …
PVO
  • 31
  • 4
0
votes
0 answers

Change type identification of boost serialize to enhance the performace

I want to serialize a huge amount of data to just able to save and load during running and startup(I do not need any version system, or compatibility during all platforms). So the performance of these jobs are critical for me. After some searches I…
motam
  • 677
  • 1
  • 6
  • 24
0
votes
3 answers

Serializing/deserializing objects with mixins

Is there a way to deal with mixins when writing/reading objects? I'm using Boost Serialization, but this is a fairly generic question. Say I have properties attached via mixins as follows: struct Point { double x,y; }; template
David Doria
  • 9,873
  • 17
  • 85
  • 147
0
votes
1 answer

boost::serialization with immutable abstract base and virtual inheritance

The code below is my current thinking to permit boost::serialization of an immutable abstract base with virtual inheritance. I hope I missed something and there is a simpler solution...? As it stands, it raises a few questions: Is the comment in…
Rai
  • 1,328
  • 11
  • 20
0
votes
1 answer

boost::serialization segmentation fault

Trying compile any program using boost::serialization text or binary archive with string or file stream I have segmentation fault error. Even for the simple code like: #include #include…
Роман Коптев
  • 1,555
  • 1
  • 13
  • 35
0
votes
1 answer

Boost Interprocess Send giving error: boost::interprocess_exception::library_error

I am using boost message queue to communicate among different processes. I am transmitting an object of type Packet. To do this, I am using serialization and deserialization in send and receive functions. However, when I try to send the data, I am…
Sapan
  • 1,593
  • 3
  • 24
  • 34
0
votes
1 answer

Error: undefined reference to `bbque::Event::Event()' on .../boost/serialization/access.hpp:132

I'm using boost v.1.55 library to serialize/deserialize but when I compile I have this error. I'm new to C++ programming and Boost libraries. event.h #ifndef BBQUE_EVENT_H_ #define BBQUE_EVENT_H_ #include #include…
rh0x
  • 1,066
  • 1
  • 13
  • 33
0
votes
1 answer

Can't find a member of boost::serialization

I am working on a project using git. I have a branch the has been compiling fine but when I tried building it from scratch I started getting this strange error at compile-time: In file included from…
ad_ad
  • 375
  • 3
  • 14
0
votes
1 answer

Create a file with a custom extension using boost serialization

I would like to know if it is possible to serialize an object using boost serialization to a file with a custom extension. Instead of a .xml, I would like to create a custom extension, for example .hst and associate a custom icon to the file. The…
DreamTool
  • 149
  • 1
  • 15
0
votes
1 answer

Serializing polymorphic classes with environment-specific state

I have some classes that look roughly like this: class Base { public: virtual ~Base() {} ... }; class Derived1 { OuterState1& outerState; InnerState1 innerState; ... template void serialize(Ar& ar, const…
petersohn
  • 11,292
  • 13
  • 61
  • 98
0
votes
0 answers

Serialising large vector using boost serialization

I have the following test code: #include #include #include #include #include #include #include…
jpen
  • 2,129
  • 5
  • 32
  • 56
0
votes
2 answers

boost serialization hexadecimal decimal encoding of data

I am new to boost serialization but this seems very strange to me. I have a very simple class with two members int number // always = 123 char buffer[?] // buffer with ? size so sometimes I set the size to buffer[31] then I serialize the class 22…
user1348669
0
votes
3 answers

Is there a way to use Boost serialization on stl functional

I have an stl functional std::function fcn_ as a member field of a class. Is there a way to serialize it using boost serialization? If I do the following template void serialize(Archive &ar, const unsigned int…
Ying Xiong
  • 4,578
  • 8
  • 33
  • 69