os/ossrv/ossrv_pub/boost_apis/boost/serialization/split_free.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/serialization/split_free.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,93 @@
     1.4 +#ifndef BOOST_SERIALIZATION_SPLIT_FREE_HPP
     1.5 +#define BOOST_SERIALIZATION_SPLIT_FREE_HPP
     1.6 +
     1.7 +// MS compatible compilers support #pragma once
     1.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
     1.9 +# pragma once
    1.10 +#endif
    1.11 +
    1.12 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
    1.13 +// split_free.hpp:
    1.14 +
    1.15 +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
    1.16 +// Use, modification and distribution is subject to the Boost Software
    1.17 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.18 +// http://www.boost.org/LICENSE_1_0.txt)
    1.19 +
    1.20 +//  See http://www.boost.org for updates, documentation, and revision history.
    1.21 +
    1.22 +#include <boost/config.hpp>
    1.23 +#include <boost/mpl/eval_if.hpp>
    1.24 +#include <boost/mpl/identity.hpp>
    1.25 +#include <boost/serialization/serialization.hpp>
    1.26 +
    1.27 +namespace boost {
    1.28 +namespace archive {
    1.29 +    namespace detail {
    1.30 +        template<class Archive> class interface_oarchive;
    1.31 +        template<class Archive> class interface_iarchive;
    1.32 +    } // namespace detail
    1.33 +} // namespace archive
    1.34 +
    1.35 +namespace serialization {
    1.36 +
    1.37 +//namespace detail {
    1.38 +template<class Archive, class T>
    1.39 +struct free_saver {
    1.40 +    static void invoke(
    1.41 +        Archive & ar, 
    1.42 +        const  T & t, 
    1.43 +        const unsigned int file_version
    1.44 +    ){
    1.45 +        // use function overload (version_type) to workaround
    1.46 +        // two-phase lookup issue
    1.47 +        const version_type v(file_version);
    1.48 +        save(ar, t, v);
    1.49 +    }
    1.50 +};
    1.51 +template<class Archive, class T>
    1.52 +struct free_loader {
    1.53 +    static void invoke(
    1.54 +        Archive & ar, 
    1.55 +        T & t, 
    1.56 +        const unsigned int file_version
    1.57 +    ){
    1.58 +        // use function overload (version_type) to workaround
    1.59 +        // two-phase lookup issue
    1.60 +        const version_type v(file_version);
    1.61 +        load(ar, t, v);
    1.62 +    }
    1.63 +};
    1.64 +//} // namespace detail
    1.65 +
    1.66 +template<class Archive, class T>
    1.67 +inline void split_free(
    1.68 +    Archive & ar, 
    1.69 +    T & t, 
    1.70 +    const unsigned int file_version
    1.71 +){
    1.72 +    typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
    1.73 +        BOOST_DEDUCED_TYPENAME Archive::is_saving,
    1.74 +        mpl::identity</* detail:: */ free_saver<Archive, T> >, 
    1.75 +        mpl::identity</* detail:: */ free_loader<Archive, T> >
    1.76 +    >::type typex;
    1.77 +    typex::invoke(ar, t, file_version);
    1.78 +}
    1.79 +
    1.80 +} // namespace serialization
    1.81 +} // namespace boost
    1.82 +
    1.83 +#define BOOST_SERIALIZATION_SPLIT_FREE(T)       \
    1.84 +namespace boost { namespace serialization {     \
    1.85 +template<class Archive>                         \
    1.86 +inline void serialize(                          \
    1.87 +        Archive & ar,                               \
    1.88 +        T & t,                                      \
    1.89 +        const unsigned int file_version             \
    1.90 +){                                              \
    1.91 +        split_free(ar, t, file_version);            \
    1.92 +}                                               \
    1.93 +}}
    1.94 +/**/
    1.95 +
    1.96 +#endif // BOOST_SERIALIZATION_SPLIT_FREE_HPP