Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/archive/detail/interface_oarchive.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 #ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP | |
2 #define BOOST_ARCHIVE_DETAIL_INTERFACE_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 // interface_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 #include <cstddef> // NULL | |
19 #include <boost/cstdint.hpp> | |
20 #include <boost/mpl/bool.hpp> | |
21 | |
22 #include <boost/archive/detail/auto_link_archive.hpp> | |
23 #include <boost/archive/detail/oserializer.hpp> | |
24 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header | |
25 | |
26 #include <boost/serialization/singleton.hpp> | |
27 | |
28 namespace boost { | |
29 namespace archive { | |
30 namespace detail { | |
31 | |
32 class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; | |
33 | |
34 template<class Archive> | |
35 class interface_oarchive | |
36 { | |
37 protected: | |
38 interface_oarchive(){}; | |
39 public: | |
40 ///////////////////////////////////////////////////////// | |
41 // archive public interface | |
42 typedef mpl::bool_<false> is_loading; | |
43 typedef mpl::bool_<true> is_saving; | |
44 | |
45 // return a pointer to the most derived class | |
46 Archive * This(){ | |
47 return static_cast<Archive *>(this); | |
48 } | |
49 | |
50 template<class T> | |
51 const basic_pointer_oserializer * | |
52 register_type(const T * = NULL){ | |
53 const basic_pointer_oserializer & bpos = | |
54 boost::serialization::singleton< | |
55 pointer_oserializer<Archive, T> | |
56 >::get_const_instance(); | |
57 this->This()->register_basic_serializer(bpos.get_basic_serializer()); | |
58 return & bpos; | |
59 } | |
60 | |
61 template<class T> | |
62 Archive & operator<<(T & t){ | |
63 this->This()->save_override(t, 0); | |
64 return * this->This(); | |
65 } | |
66 | |
67 // the & operator | |
68 template<class T> | |
69 Archive & operator&(T & t){ | |
70 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING | |
71 return * this->This() << const_cast<const T &>(t); | |
72 #else | |
73 return * this->This() << t; | |
74 #endif | |
75 } | |
76 }; | |
77 | |
78 } // namespace detail | |
79 } // namespace archive | |
80 } // namespace boost | |
81 | |
82 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas | |
83 | |
84 #endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP |