]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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) | |
6 | # pragma once | |
7 | #endif | |
8 | ||
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | |
10 | // common_oarchive.hpp | |
11 | ||
f67539c2 | 12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
7c673cae FG |
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/config.hpp> | |
20 | ||
21 | #include <boost/archive/detail/basic_oarchive.hpp> | |
22 | #include <boost/archive/detail/interface_oarchive.hpp> | |
23 | ||
24 | #ifdef BOOST_MSVC | |
25 | # pragma warning(push) | |
26 | # pragma warning(disable : 4511 4512) | |
27 | #endif | |
28 | ||
29 | namespace boost { | |
30 | namespace archive { | |
31 | namespace detail { | |
32 | ||
33 | // note: referred to as Curiously Recurring Template Patter (CRTP) | |
34 | template<class Archive> | |
35 | ||
36 | class BOOST_SYMBOL_VISIBLE common_oarchive : | |
37 | public basic_oarchive, | |
38 | public interface_oarchive<Archive> | |
39 | { | |
40 | friend class interface_oarchive<Archive>; | |
b32b8144 | 41 | friend class basic_oarchive; |
7c673cae FG |
42 | private: |
43 | virtual void vsave(const version_type t){ | |
44 | * this->This() << t; | |
45 | } | |
46 | virtual void vsave(const object_id_type t){ | |
47 | * this->This() << t; | |
48 | } | |
49 | virtual void vsave(const object_reference_type t){ | |
50 | * this->This() << t; | |
51 | } | |
52 | virtual void vsave(const class_id_type t){ | |
53 | * this->This() << t; | |
54 | } | |
55 | virtual void vsave(const class_id_reference_type t){ | |
56 | * this->This() << t; | |
57 | } | |
58 | virtual void vsave(const class_id_optional_type t){ | |
59 | * this->This() << t; | |
60 | } | |
61 | virtual void vsave(const class_name_type & t){ | |
62 | * this->This() << t; | |
63 | } | |
64 | virtual void vsave(const tracking_type t){ | |
65 | * this->This() << t; | |
66 | } | |
67 | protected: | |
68 | // default processing - invoke serialization library | |
69 | template<class T> | |
70 | void save_override(T & t){ | |
71 | archive::save(* this->This(), t); | |
72 | } | |
73 | void save_start(const char * /*name*/){} | |
74 | void save_end(const char * /*name*/){} | |
f67539c2 | 75 | common_oarchive(unsigned int flags = 0) : |
7c673cae FG |
76 | basic_oarchive(flags), |
77 | interface_oarchive<Archive>() | |
78 | {} | |
79 | }; | |
80 | ||
81 | } // namespace detail | |
82 | } // namespace archive | |
83 | } // namespace boost | |
84 | ||
85 | #ifdef BOOST_MSVC | |
86 | #pragma warning(pop) | |
87 | #endif | |
88 | ||
89 | #endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP |