sl@0: #ifndef BOOST_SERIALIZATION_ACCESS_HPP sl@0: #define BOOST_SERIALIZATION_ACCESS_HPP sl@0: sl@0: // MS compatible compilers support #pragma once sl@0: #if defined(_MSC_VER) && (_MSC_VER >= 1020) sl@0: # pragma once sl@0: #endif sl@0: sl@0: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 sl@0: // access.hpp: interface for serialization system. sl@0: sl@0: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . sl@0: // Use, modification and distribution is subject to the Boost Software sl@0: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: sl@0: // See http://www.boost.org for updates, documentation, and revision history. sl@0: sl@0: #include sl@0: sl@0: #include sl@0: sl@0: namespace boost { sl@0: sl@0: namespace archive { sl@0: namespace detail { sl@0: template sl@0: class iserializer; sl@0: template sl@0: class oserializer; sl@0: } // namespace detail sl@0: } // namespace archive sl@0: sl@0: namespace serialization { sl@0: sl@0: // forward declarations sl@0: template sl@0: inline void serialize_adl(Archive &, T &, const unsigned int); sl@0: namespace detail { sl@0: template sl@0: struct member_saver; sl@0: template sl@0: struct member_loader; sl@0: } // namespace detail sl@0: sl@0: // use an "accessor class so that we can use: sl@0: // "friend class boost::serialization::access;" sl@0: // in any serialized class to permit clean, safe access to private class members sl@0: // by the serialization system sl@0: sl@0: class access { sl@0: public: sl@0: // grant access to "real" serialization defaults sl@0: #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS sl@0: public: sl@0: #else sl@0: template sl@0: friend struct detail::member_saver; sl@0: template sl@0: friend struct detail::member_loader; sl@0: template sl@0: friend class archive::detail::iserializer; sl@0: template sl@0: friend class archive::detail::oserializer; sl@0: template sl@0: friend inline void serialize( sl@0: Archive & ar, sl@0: T & t, sl@0: const BOOST_PFTO unsigned int file_version sl@0: ); sl@0: template sl@0: friend inline void save_construct_data( sl@0: Archive & ar, sl@0: const T * t, sl@0: const BOOST_PFTO unsigned int file_version sl@0: ); sl@0: template sl@0: friend inline void load_construct_data( sl@0: Archive & ar, sl@0: T * t, sl@0: const BOOST_PFTO unsigned int file_version sl@0: ); sl@0: #endif sl@0: sl@0: // pass calls to users's class implementation sl@0: template sl@0: static void member_save( sl@0: Archive & ar, sl@0: //const T & t, sl@0: T & t, sl@0: const unsigned int file_version sl@0: ){ sl@0: t.save(ar, file_version); sl@0: } sl@0: template sl@0: static void member_load( sl@0: Archive & ar, sl@0: T & t, sl@0: const unsigned int file_version sl@0: ){ sl@0: t.load(ar, file_version); sl@0: } sl@0: template sl@0: static void serialize( sl@0: Archive & ar, sl@0: T & t, sl@0: const unsigned int file_version sl@0: ){ sl@0: t.serialize(ar, file_version); sl@0: } sl@0: template sl@0: static void destroy( const T * t) // const appropriate here? sl@0: { sl@0: // the const business is an MSVC 6.0 hack that should be sl@0: // benign on everything else sl@0: delete const_cast(t); sl@0: } sl@0: template sl@0: static void construct(Archive & /* ar */, T * t){ sl@0: // default is inplace invocation of default constructor sl@0: // Note the :: before the placement new. Required if the sl@0: // class doesn't have a class-specific placement new defined. sl@0: ::new(t)T; sl@0: } sl@0: }; sl@0: sl@0: } // namespace serialization sl@0: } // namespace boost sl@0: sl@0: #endif // BOOST_SERIALIZATION_ACCESS_HPP