/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // archive_pointer_oserializer.ipp: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for updates, documentation, and revision history. #include // msvc 6.0 needs this for warning suppression #include #include namespace boost { namespace archive { namespace detail { template basic_serializer_map * oserializer_map(){ static bool deleted = false; static basic_serializer_map map(deleted); return deleted ? NULL : & map; } template BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) archive_pointer_oserializer::archive_pointer_oserializer( const boost::serialization::extended_type_info & eti ) : basic_pointer_oserializer(eti) { basic_serializer_map *mp = oserializer_map(); assert(NULL != mp); mp->insert(this); } template BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_oserializer *) archive_pointer_oserializer::find( const boost::serialization::extended_type_info & eti ){ basic_serializer_map *mp = oserializer_map(); assert(NULL != mp); return static_cast(mp->tfind(eti)); } template BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) archive_pointer_oserializer::~archive_pointer_oserializer(){ // note: we need to check that the map still exists as we can't depend // on static variables being constructed in a specific sequence basic_serializer_map *mp = oserializer_map(); if(NULL == mp) return; mp->erase(this); } } // namespace detail } // namespace archive } // namespace boost