123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- #ifndef BOOST_SERIALIZATION_SHARED_PTR_HPP
- #define BOOST_SERIALIZATION_SHARED_PTR_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma once
- #endif
- #include <map>
- #include <cstddef>
- #include <boost/config.hpp>
- #include <boost/mpl/integral_c.hpp>
- #include <boost/mpl/integral_c_tag.hpp>
- #include <boost/detail/workaround.hpp>
- #include <boost/shared_ptr.hpp>
- #include <boost/serialization/split_free.hpp>
- #include <boost/serialization/nvp.hpp>
- #include <boost/serialization/version.hpp>
- #include <boost/serialization/tracking.hpp>
- #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- namespace boost {
- namespace serialization{
- template<class T>
- struct version< ::boost::shared_ptr<T> > {
- typedef mpl::integral_c_tag tag;
- #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
- typedef BOOST_DEDUCED_TYPENAME mpl::int_<1> type;
- #else
- typedef mpl::int_<1> type;
- #endif
- #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
- BOOST_STATIC_CONSTANT(unsigned int, value = 1);
- #else
- BOOST_STATIC_CONSTANT(unsigned int, value = type::value);
- #endif
- };
-
- template<class T>
- struct tracking_level< ::boost::shared_ptr<T> > {
- typedef mpl::integral_c_tag tag;
- #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
- typedef BOOST_DEDUCED_TYPENAME mpl::int_< ::boost::serialization::track_never> type;
- #else
- typedef mpl::int_< ::boost::serialization::track_never> type;
- #endif
- #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
- BOOST_STATIC_CONSTANT(int, value = ::boost::serialization::track_never);
- #else
- BOOST_STATIC_CONSTANT(int, value = type::value);
- #endif
- };
- }}
- #define BOOST_SERIALIZATION_SHARED_PTR(T)
- #else
-
- #define BOOST_SERIALIZATION_SHARED_PTR(T) \
- BOOST_CLASS_VERSION( \
- ::boost::shared_ptr< T >, \
- 1 \
- ) \
- BOOST_CLASS_TRACKING( \
- ::boost::shared_ptr< T >, \
- ::boost::serialization::track_never \
- ) \
-
- #endif
- namespace boost {
- namespace serialization{
- template<class Archive, class T>
- inline void save(
- Archive & ar,
- const boost::shared_ptr<T> &t,
- const unsigned int
- ){
-
-
-
- BOOST_STATIC_ASSERT((tracking_level<T>::value != track_never));
- const T * t_ptr = t.get();
- ar << boost::serialization::make_nvp("px", t_ptr);
- }
- template<class Archive, class T>
- inline void load(
- Archive & ar,
- boost::shared_ptr<T> &t,
- const unsigned int file_version
- ){
-
-
-
- BOOST_STATIC_ASSERT((tracking_level<T>::value != track_never));
- T* r;
- #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
- if(file_version < 1){
-
-
-
- ar.register_type(static_cast<
- boost_132::detail::sp_counted_base_impl<T *, boost::archive::detail::null_deleter > *
- >(NULL));
- boost_132::shared_ptr<T> sp;
- ar >> boost::serialization::make_nvp("px", sp.px);
- ar >> boost::serialization::make_nvp("pn", sp.pn);
-
- ar.append(sp);
- r = sp.get();
- }
- else
- #endif
- {
- ar >> boost::serialization::make_nvp("px", r);
- }
- ar.reset(t,r);
- }
- template<class Archive, class T>
- inline void serialize(
- Archive & ar,
- boost::shared_ptr<T> &t,
- const unsigned int file_version
- ){
-
-
- BOOST_STATIC_ASSERT(
- boost::serialization::tracking_level<T>::value
- != boost::serialization::track_never
- );
- boost::serialization::split_free(ar, t, file_version);
- }
- }
- }
- #endif
|