1 #ifndef BOOST_SERIALIZATION_NVP_HPP
2 #define BOOST_SERIALIZATION_NVP_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // nvp.hpp: interface for serialization system.
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)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/core/nvp.hpp>
20 #include <boost/preprocessor/stringize.hpp>
22 #define BOOST_SERIALIZATION_NVP(name) \
23 boost::serialization::make_nvp(BOOST_PP_STRINGIZE(name), name)
26 #define BOOST_SERIALIZATION_BASE_OBJECT_NVP(name) \
27 boost::serialization::make_nvp( \
28 BOOST_PP_STRINGIZE(name), \
29 boost::serialization::base_object<name >(*this) \
33 #include <boost/serialization/level.hpp>
34 #include <boost/serialization/tracking.hpp>
35 #include <boost/serialization/split_free.hpp>
36 #include <boost/serialization/wrapper.hpp>
37 #include <boost/serialization/base_object.hpp>
40 namespace serialization {
42 template<class Archive, class T>
46 const unsigned int /* file_version */
48 ar << t.const_value();
50 template<class Archive, class T>
54 const unsigned int /* file_version */
59 template<class Archive, class T>
60 inline void serialize(
63 const unsigned int file_version
65 split_free(ar, t, file_version);
69 struct implementation_level<nvp< T > >
71 typedef mpl::integral_c_tag tag;
72 typedef mpl::int_<object_serializable> type;
73 BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
76 struct implementation_level<const nvp< T > >
78 typedef mpl::integral_c_tag tag;
79 typedef mpl::int_<object_serializable> type;
80 BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
83 // nvp objects are generally created on the stack and are never tracked
85 struct tracking_level<nvp< T > >
87 typedef mpl::integral_c_tag tag;
88 typedef mpl::int_<track_never> type;
89 BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
92 struct tracking_level<const nvp< T > >
94 typedef mpl::integral_c_tag tag;
95 typedef mpl::int_<track_never> type;
96 BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
99 // these traits aren't used by nvp so they don't need to be defined
102 struct version<const nvp< T > > {
103 typedef mpl::integral_c_tag tag;
104 typedef mpl::int_<0> type;
105 BOOST_STATIC_CONSTANT(int, value = 0);
107 struct version<const nvp< T > > {
108 typedef mpl::integral_c_tag tag;
109 typedef mpl::int_<0> type;
110 BOOST_STATIC_CONSTANT(int, value = 0);
114 struct extended_type_info_impl<const nvp< T > > {
115 typedef extended_type_info_impl< T > type;
120 struct is_wrapper<const nvp<T> > {
121 typedef boost::mpl::true_ type;
124 struct is_wrapper<nvp<T> > {
125 typedef boost::mpl::true_ type;
133 #endif // BOOST_SERIALIZATION_NVP_HPP