Serialization - Derivation from an Existing Archive

###  | # Serialization ## A Simple Logging Archive Class

The purpose of this example is to help clarify the usage of the Archive Concept so that one can implement his own archive classes. `simple_log_archive.hpp` implements a simple but useful archive class. This class can be used to send any serializable types on an output text stream in a readable format. Usage of this facility is trivially easy:

    #include "simple_log_archive.hpp"
    ...
    // display the complete schedule
    simple_log_archive log(std::cout);
    log << schedule;

and it produces the following output

    schedule
     count 6
     item
      first
       driver bob
       hour 6
       minute 24
      second ->
       stops
        count 3
        item ->
         latitude
          degrees 34
          minutes 135
          seconds 52.56
         longitude
          degrees 134
          minutes 22
          seconds 78.3
    ...

The complete example is `demo_simple_log.cpp`. Look at Trivial Archive to get a better understanding of how this works. Also, note the following:

- Only 160 lines of code.
- Header only - linking with the serialization library not required.
- Displays ALL Serializable types.
- Lacks some features.
  - it will not display the data from the derived type given the pointer to a polymorphic base class. That is, only displays the information of the base class. To add that see the next example.
  - doesn't display information serialized as binary data

© Copyright Robert Ramey 2002-2010. 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)