C++ Boost

Serialization

Text Archive Class Diagram





basic_oarchive ->
      |
      |
      |      interface_oarchive<text_oarchive> ->
      |                     /
      |                   /
      |        _________/
      |      /
      |    /
      |  /
common_oarchive<text_oarchive> ->
      |
      |
basic_text_oarchive<text_oarchive> ->
      |
      |
      |     basic_text_oprimitive<basic_ostream> ->
      |                    /
      |                  /
      |       _________/                  interface_oarchive<polymorphic_oarchive> ->
      |     /                                                |
      |   /                                                  |
      | /                                                    |
text_oarchive_impl<text_oarchive> ->              polymorphic_oarchive_impl ->
      | \                                                    |
      |   \                                                  |
      |     \_____________________________________    polymorphic_oarchive ->
      |                                           \         /
      |                                             \     /
      |                                               \ /  
text_oarchive ->                 polymorphic_oarchive_route<text_oarchive_impl<text_oarchive> > ->
                                                       |
                                                       |
                                                       |
                                             polymorphic_text_oarchive ->


This diagram shows the relationship between the various classes that implement saving (output serialization) for text archives. The hierarchy and organization is similar for loading and for other types of archives as well. In the diagram, classes written in blue implement saving for a given archive type. (in this case it's text archives). Users include classes in red to save their data from a particular type of archive. Other classes whose names are in black implement the library and should never change. They are in namespace boost::archive::detail
basic_oarchive
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_oarchive<text_oarchive>
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_oarchive as well as for archive implementations.

common_oarchive<text_oarchive>
The function of this class is to make the connection between the virtual function interface used by basic_oarchive and the template interface used by archive class implementations.

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

basic_text_oprimitive<basic_ostream>
Implements the save oversaves for all primitive types. This is a template with a parameter which describes the stream.

text_oarchive_impl<text_oarchive>
Inherits from the above two classes to implement text archives.

text_oarchive
This is just a short hand for text_oarchive_impl<text_oarchive> . 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_oarchive<polymorphic_oarchive>
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_oarchive uses.

polymorphic_oarchive
A class with a list of virtual save(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_oarchive_route<text_oarchive_impl<text_oarchive> >

This class implements the polymorphic_oarchive in terms of a specific concrete class. Virtual function calls are routed to the implementing class. In this example, that implementing class would be text_oarchive_impl.

polymorphic_text_oarchive
this is just a typedef so we can write polymorphic_text_archive rather than polymorphic_oarchive_route<text_oarchive_impl<text_oarchive> >

© 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)