Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/serialization/doc/overview.html @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 6.8 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!--
4(C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
5Use, modification and distribution is subject to the Boost Software
6License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7http://www.boost.org/LICENSE_1_0.txt)
8-->
9<head>
10<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
11<link rel="stylesheet" type="text/css" href="../../../boost.css">
12<link rel="stylesheet" type="text/css" href="style.css">
13<title>Serialization - Overview</title>
14</head>
15<body link="#0000ff" vlink="#800080">
16<table border="0" cellpadding="7" cellspacing="0" width="100%" summary="header">
17  <tr> 
18    <td valign="top" width="300"> 
19      <h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3>
20    </td>
21    <td valign="top"> 
22      <h1 align="center">Serialization</h1>
23      <h2 align="center">Overview</h2>
24    </td>
25  </tr>
26</table>
27<hr>
28<dl class="index">
29  <dt><a href="#Requirements">Requirements</a></dt>
30  <dt><a href="#otherimplementations">Other Implementations</a></dt>
31  <!--
32  <dt><a href="#footnotes">Footnotes</a></dt>
33  -->
34</dl>
35<p>Here, we use the term <strong>"serialization"</strong> to mean
36the reversible deconstruction of an arbitrary set of C++ data structures
37to a sequence of bytes.  Such a system can be used to reconstitute
38an equivalent structure in another program context.  Depending on
39the context, this might used implement object persistence, remote
40parameter passing or other facility. In this system we use the term
41<strong>"archive"</strong> to refer to a specific rendering of this
42stream of bytes.  This could be a file of binary data, text data,
43XML, or some other created by the user of this library.
44<h2><a name="Requirements"></a>Our goals for such a system are:</h2>
45   <ol>
46      <li>Code portability - depend only on ANSI C++ facilities.
47
48      <li>Code economy - exploit features of C++ such as RTTI,
49      templates, and multiple inheritance, etc. where appropriate to
50      make code shorter and simpler to use.
51
52      <li>Independent versioning for each class definition. That
53      is, when a class definition changed, older files can still be
54      imported to the new version of the class.
55
56      <li>Deep pointer save and restore. That is, save and restore
57      of pointers saves and restores the data pointed to.
58
59      <li>Proper restoration of pointers to shared data.
60
61      <li>Serialization of STL containers and other commonly used
62      templates.
63
64      <li>Data Portability - Streams of bytes created on one platform
65      should be readable on any other.
66
67      <li>Orthogonal specification of class serialization and archive format.
68      That is, any file format should be able to store serialization
69      of any arbitrary set of C++ data structures without having to
70      alter the serialization of any class.
71
72      <li>Non-intrusive. Permit serialization to be applied to
73      unaltered classes. That is, don't require that classes to be
74      serialized be derived from a specific base class or implement
75      specified member functions. This is necessary to easily
76      permit serialization to be applied to classes from class
77      libraries that we cannot or don't want to have to alter.
78
79      <li> The <strong>archive</strong> interface must be simple
80      enough to easily permit creation of a new type of archive.
81
82      <li> The <strong>archive</strong> interface must be rich
83      enough to permit the creation of an <strong>archive</strong>
84      that presents serialized data as XML in a useful manner.
85   </ol>
86
87<h2><a name="otherimplementations"></a>Other implementations</h2>
88    Before getting started I searched around for current
89    implementations. I found several.
90
91    <ul>
92      <li><u>MFC</u> This is the one that I am very familiar with.
93      I have used it for several years and have found it very useful.
94      However it fails requirements 1, 2, 3, 6, 7, and 9. In spite
95      of all the requirements not fulfilled, this is the most
96      useful implementation I've found. It turns out that class
97      versioning - partially implemented in MFC - really is
98      indispensable for my applications. Inevitably, version 1.x of
99      a shipping program needs to store more information in files
100      than was originally provided for. MFC is the only one of these
101      implementations that supports this - though only for the most
102      derived class. Still it's better than nothing and does the
103      job. MFC doesn't implement serialization of STL collections.
104      Though it does so for MFC collections.
105
106      <li><u>CommonC++ libraries</u> <a href="bibliography.html#1">[1]</a>
107      As far as I can tell, this
108      closely follows the MFC implementation but does address a few
109      of the issues. It is portable and creates portable archives but
110      skips versioning. It does support proper and complete
111      restoration of pointers and STL collections. It does address
112      compression though not in the way that I would prefer. The
113      package would also benefit from having better documentation.
114      So it fails to address 2, 3, 7, 8, and 9.
115
116      <li><u>Eternity</u> <a href="bibliography.html#2">[2]</a> 
117      This is a bare bones package. It
118      seems well coded but it really needs documentation and
119      examples. It's not obvious how to use it without time
120      consuming study of the source code. Recent versions do support
121      files in XML format.  This Fails 3, 6, 7?, 8, and 9.
122
123      <li><u>Holub's implementation</u> <a href="bibliography.html#3">[3]</a> This is the article that
124      first got me thinking about my own requirements for
125      a serialization implementation. Interesting and worth
126      the read if you can overlook the arrogant tone of the prose.
127      This implementation fails 2, 3, 4, 5, and 6.
128
129      <li><u>s11n</u> <a href="bibliography.html#13">[13]</a>
130      This library has similar goals to this one. Some aspects of the
131      implemenation are also similar.  As of this writing, it would seem that:
132      <ul>
133          <li>Portability(1) is guarenteed only for recent versions of GCC.
134          <li>Versioning(3) of class definitions is not explicitly supported by
135          the library.
136          <li>it doesn't seem to automatically account for shared pointers(5).
137          I concluded this from the documentation as well as the statement that
138          serialization of graph like structures is not supported.
139      </ul>
140      Its has lots of differences - and lots in common with this implementation.
141    </ul>
142<hr>
143<p>Revised 1 November, 2004
144<p><i>&copy; Copyright <a href="http://www.rrsd.com">Robert Ramey</a> 2002-2004.
145Distributed under the Boost Software License, Version 1.0. (See
146accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
147</i></p>
148</body>
149</html>
Note: See TracBrowser for help on using the repository browser.