Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:45

0001 #ifndef BOOST_SERIALIZATION_SPLIT_FREE_HPP
0002 #define BOOST_SERIALIZATION_SPLIT_FREE_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // split_free.hpp:
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 #include <boost/config.hpp>
0020 #include <boost/mpl/eval_if.hpp>
0021 #include <boost/mpl/identity.hpp>
0022 #include <boost/serialization/serialization.hpp>
0023 
0024 namespace boost {
0025 namespace archive {
0026     namespace detail {
0027         template<class Archive> class interface_oarchive;
0028         template<class Archive> class interface_iarchive;
0029     } // namespace detail
0030 } // namespace archive
0031 
0032 namespace serialization {
0033 
0034 template<class Archive, class T>
0035 struct free_saver {
0036     static void invoke(
0037         Archive & ar,
0038         const T & t,
0039         const unsigned int file_version
0040     ){
0041         // use function overload (version_type) to workaround
0042         // two-phase lookup issue
0043         const version_type v(file_version);
0044         save(ar, t, v);
0045     }
0046 };
0047 template<class Archive, class T>
0048 struct free_loader {
0049     static void invoke(
0050         Archive & ar,
0051         T & t,
0052         const unsigned int file_version
0053     ){
0054         // use function overload (version_type) to workaround
0055         // two-phase lookup issue
0056         const version_type v(file_version);
0057         load(ar, t, v);
0058     }
0059 };
0060 
0061 template<class Archive, class T>
0062 inline void split_free(
0063     Archive & ar,
0064     T & t,
0065     const unsigned int file_version
0066 ){
0067     typedef typename mpl::eval_if<
0068         typename Archive::is_saving,
0069         mpl::identity</* detail:: */ free_saver<Archive, T> >,
0070         mpl::identity</* detail:: */ free_loader<Archive, T> >
0071     >::type typex;
0072     typex::invoke(ar, t, file_version);
0073 }
0074 
0075 } // namespace serialization
0076 } // namespace boost
0077 
0078 #define BOOST_SERIALIZATION_SPLIT_FREE(T)       \
0079 namespace boost { namespace serialization {     \
0080 template<class Archive>                         \
0081 inline void serialize(                          \
0082         Archive & ar,                               \
0083         T & t,                                      \
0084         const unsigned int file_version             \
0085 ){                                              \
0086         split_free(ar, t, file_version);            \
0087 }                                               \
0088 }}
0089 /**/
0090 
0091 #endif // BOOST_SERIALIZATION_SPLIT_FREE_HPP