1 | #ifndef BOOST_SERIALIZATION_QUEUE_HPP |
2 | #define BOOST_SERIALIZATION_QUEUE_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 | // queue.hpp |
11 | |
12 | // (C) Copyright 2014 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 <queue> |
20 | #include <boost/config.hpp> |
21 | |
22 | // function specializations must be defined in the appropriate |
23 | // namespace - boost::serialization |
24 | #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) |
25 | #define STD _STLP_STD |
26 | #else |
27 | #define STD std |
28 | #endif |
29 | |
30 | namespace boost { |
31 | namespace serialization { |
32 | namespace detail { |
33 | |
34 | template <typename U, typename C> |
35 | struct queue_save : public STD::queue<U, C> { |
36 | template<class Archive> |
37 | void operator()(Archive & ar, const unsigned int file_version) const { |
38 | save(ar, STD::queue<U, C>::c, file_version); |
39 | } |
40 | }; |
41 | template <typename U, typename C> |
42 | struct queue_load : public STD::queue<U, C> { |
43 | template<class Archive> |
44 | void operator()(Archive & ar, const unsigned int file_version) { |
45 | load(ar, STD::queue<U, C>::c, file_version); |
46 | } |
47 | }; |
48 | |
49 | } // detail |
50 | |
51 | template<class Archive, class T, class C> |
52 | inline void serialize( |
53 | Archive & ar, |
54 | std::queue< T, C> & t, |
55 | const unsigned int file_version |
56 | ){ |
57 | typedef typename mpl::eval_if< |
58 | typename Archive::is_saving, |
59 | mpl::identity<detail::queue_save<T, C> >, |
60 | mpl::identity<detail::queue_load<T, C> > |
61 | >::type typex; |
62 | static_cast<typex &>(t)(ar, file_version); |
63 | } |
64 | |
65 | } // namespace serialization |
66 | } // namespace boost |
67 | |
68 | #include <boost/serialization/collection_traits.hpp> |
69 | |
70 | BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::queue) |
71 | |
72 | #undef STD |
73 | |
74 | #endif // BOOST_SERIALIZATION_QUEUE_HPP |
75 | |