source: NonGTP/Boost/boost/archive/detail/common_oarchive.hpp @ 857

Revision 857, 2.0 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]1#ifndef BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
2#define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER) && (_MSC_VER >= 1020)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// common_oarchive.hpp
11
12// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17//  See http://www.boost.org for updates, documentation, and revision history.
18
19#include <boost/archive/detail/basic_oarchive.hpp>
20#include <boost/archive/detail/interface_oarchive.hpp>
21
22namespace boost {
23namespace archive {
24namespace detail {
25
26// note: referred to as Curiously Recurring Template Patter (CRTP)
27template<class Archive>
28class common_oarchive :
29    public basic_oarchive,
30    public interface_oarchive<Archive>
31{
32private:
33    virtual void vsave(const version_type t){
34        * this->This() << t;
35    }
36    virtual void vsave(const object_id_type t){
37        * this->This() << t;
38    }
39    virtual void vsave(const object_reference_type t){
40        * this->This() << t;
41    }
42    virtual void vsave(const class_id_type t){
43        * this->This() << t;
44    }
45    virtual void vsave(const class_id_reference_type t){
46        * this->This() << t;
47    }
48    virtual void vsave(const class_id_optional_type t){
49        * this->This() << t;
50    }
51    virtual void vsave(const class_name_type & t){
52        * this->This() << t;
53    }
54    virtual void vsave(const tracking_type t){
55        * this->This() << t;
56    }
57protected:
58    void save_start(const char *name){}
59    void save_end(const char *name){}
60    common_oarchive(unsigned int flags) :
61        basic_oarchive(flags),
62        interface_oarchive<Archive>()
63    {}
64};
65
66} // namespace detail
67} // namespace archive
68} // namespace boost
69
70#endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
Note: See TracBrowser for help on using the repository browser.