###

# Serialization

## Archive Class Diagram

    basic_iarchive ->
          |
          |
          |      interface_iarchive<text_iarchive> ->
          |                     /
          |                   /
          |        _________/
          |      /
          |    /
          |  /
    common_iarchive<text_iarchive> ->
          |
          |
    basic_text_iarchive<text_iarchive> ->
          |
          |
          |     basic_text_iprimitive<basic_istream> ->
          |                    /
          |                  /
          |       _________/                  interface_iarchive<polymorphic_iarchive> ->
          |     /                                                |
          |   /                                                  |
          | /                                                    |
    text_iarchive_impl<text_iarchive> ->                 polymorphic_iarchive ->
          | \                                                    |
          |   \                                                  |
          |     \_____________________________________           |
          |                                           \         /
          |                                             \     /
          |                                               \ /
    text_iarchive ->                 polymorphic_iarchive_impl<text_iarchive_impl<text_iarchive> > ->
                                                           |
                                                           |
                                                           |
                                                 polymorphic_text_iarchive ->

This diagram shows the relationship between the various classes that implement loading (input serialization) for text files. The hierachy and organization is identical for saving and for other types of archives as well. In the diagram, classes written in blue implement loading for a given archive type. (in this case its text archives). Users include classes in red to load their data from a partcular type of archive. Other classes whose names are in black implment the library and should never change. They are in `namespace boost::archive::detail`

`basic_iarchive`
  Implements the core library functions for class export, versioning, and object tracking. It is compiled into the library as it has no template parameters.

`interface_iarchive<text_iarchive>`
  A class that declares the standard archive interface. This has been factored out so that it can be used as a base class for `polymorphic_iarchive` as well as for archive implementations.

`common_iarchive<text_iarchive>`
  The function of this class is to make the connection between the virtual function interface used by `basic_iarchive` and the template interface used by archive class implementations.

`basic_text_iarchive<text_iarchive>`
  Implements the basic functionality for simple text archives. The primitive load functions have been factored out so it can be used in other text based archives like XML archives.

`basic_text_iprimitive<basic_istream>`
  Implements the save overloads for all primitive types. This is a template with a parameter which describes the stream.

`text_iarchive_impl<text_iarchive>`
  Inherits from the above two classes to implement text archives.

`text_iarchive`
  This is just a short hand for `text_iarchive_impl<text_iarchive>` . We can't use `typedef` because a `typedef` can't refer to it self in its definition. This is the class name that is used to serialize to a text archive.

`interface_iarchive<polymorphic_iarchive>`
  Same template as above. However, this time the Archive parameter refers to the polymorphic archive with a virtual function interface rather than that the template interface that `common_iarchive` uses.

`polymorphic_iarchive`
  A class with a list of virtual `load(T &t)` for all primitive types T. This is the class that is used to do pre-compile serialization of classes for all archives present and future.

`polymorphic_iarchive_impl<text_iarchive_impl<text_iarchive> >`

  This class implements the `polymorphic_iarchive` in terms of a specific concrete class. Virtual function calls are forwarded to the implementing class. In this example, that impelenting class would be text_iarchive_impl.

`polymorphic_text_iarchive`
  this is just a typedef so we can write polymorphic_text_archive rather than `polymorphic_iarchive_impl<text_iarchive_impl<text_iarchive> >`

© Copyright Robert Ramey 2002-2004. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)