diff -r 666f914201fb -r 2fe1408b6811 epoc32/include/stdapis/boost/serialization/export.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/epoc32/include/stdapis/boost/serialization/export.hpp Tue Mar 16 16:12:26 2010 +0000 @@ -0,0 +1,280 @@ +#ifndef BOOST_SERIALIZATION_EXPORT_HPP +#define BOOST_SERIALIZATION_EXPORT_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// export.hpp: set traits of classes to be serialized + +// (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. + +// implementation of class export functionality. This is an alternative to +// "forward declaration" method to provoke instantiation of derived classes +// that are to be serialized through pointers. + +#include + +#include + +// if no archive headers have been included this is a no op +// this is to permit BOOST_EXPORT etc to be included in a +// file declaration header +#if ! defined(BOOST_ARCHIVE_BASIC_ARCHIVE_HPP) +#define BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, K, ASEQ) + +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +// forward template declarations +class basic_pointer_iserializer; +template +BOOST_DLLEXPORT const basic_pointer_iserializer & +instantiate_pointer_iserializer(Archive * ar, T *) BOOST_USED; + +class basic_pointer_oserializer; +template +BOOST_DLLEXPORT const basic_pointer_oserializer & +instantiate_pointer_oserializer(Archive * ar, T *) BOOST_USED; + +namespace export_impl +{ + struct nothing{ + static void instantiate(){} + }; + + template + struct archive { + struct i { + static void invoke(){ + instantiate_pointer_iserializer( + static_cast(NULL), + static_cast(NULL) + ); + } + }; + struct o { + static void invoke(){ + instantiate_pointer_oserializer( + static_cast(NULL), + static_cast(NULL) + ); + } + }; + static void instantiate(){ + #if defined(__GNUC__) && (__GNUC__ >= 3) + BOOST_STATIC_ASSERT( + Archive::is_loading::value || Archive::is_saving::value + ); + #endif + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME Archive::is_saving, + mpl::identity, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME Archive::is_loading, + mpl::identity, + // else + mpl::identity + > >::type typex; + typex::invoke(); + } + }; + + template + struct for_each_archive { + private: + typedef BOOST_DEDUCED_TYPENAME mpl::pop_front::type tail; + typedef BOOST_DEDUCED_TYPENAME mpl::front::type head; + public: + static void instantiate(){ + archive::instantiate(); + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + mpl::empty, + mpl::identity, + mpl::identity > + >::type typex; + typex::instantiate(); + } + }; + +} // namespace export_impl + +// strictly conforming +template +struct export_generator { + export_generator(){ + export_impl::for_each_archive::instantiate(); + } + static const export_generator instance; +}; + +template +const export_generator + export_generator::instance; + +// instantiation of this template creates a static object. +template +struct guid_initializer { + typedef BOOST_DEDUCED_TYPENAME boost::serialization::type_info_implementation::type eti_type; + static void export_register(const char *key){ + eti_type::export_register(key); + } + static const guid_initializer instance; + guid_initializer(const char *key = 0) BOOST_USED ; +}; + +template +guid_initializer::guid_initializer(const char *key){ + if(0 != key) + export_register(key); +} + +template +const guid_initializer guid_initializer::instance; + +// only gcc seems to be able to explicitly instantiate a static instance. +// but all can instantiate a function that refers to a static instance + +// the following optimization - inhibiting explicit instantiation for abstract +// classes breaks msvc compliles +template +struct export_instance { + struct abstract { + static const export_generator * + invoke(){ + return 0; + } + }; + struct not_abstract { + static const export_generator * + invoke(){ + return & export_generator::instance; + } + }; +}; + +template +BOOST_DLLEXPORT +std::pair *, const guid_initializer *> +export_instance_invoke() { + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + serialization::is_abstract, + mpl::identity::abstract>, + mpl::identity::not_abstract> + >::type typex; + return std::pair *, const guid_initializer *>( + typex::invoke(), + & guid_initializer::instance + ); +} + +template +struct export_archives { + struct empty_archive_list { + static BOOST_DLLEXPORT + std::pair *, const guid_initializer *> + invoke(){ + return std::pair *, + const guid_initializer *>(0, 0); + } + }; + struct non_empty_archive_list { + static BOOST_DLLEXPORT + std::pair *, const guid_initializer *> + invoke(){ + return export_instance_invoke(); + } + }; +}; + +template +BOOST_DLLEXPORT +std::pair *, const guid_initializer *> +export_archives_invoke(T &, ASeq &){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + mpl::empty, + mpl::identity::empty_archive_list>, + mpl::identity::non_empty_archive_list> + >::type typex; + return typex::invoke(); +} + +} // namespace detail +} // namespace archive +} // namespace boost + +#define BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, K, ASEQ) \ + namespace boost { \ + namespace archive { \ + namespace detail { \ + template<> \ + const guid_initializer< T > \ + guid_initializer< T >::instance(K); \ + template \ + BOOST_DLLEXPORT \ + std::pair *, const guid_initializer< T > *> \ + export_archives_invoke(T &, ASEQ &); \ + } } } \ + /**/ + +#endif + +// check for unnecessary export. T isn't polymorphic so there is no +// need to export it. +#define BOOST_CLASS_EXPORT_CHECK(T) \ + BOOST_STATIC_WARNING( \ + boost::serialization::type_info_implementation< T > \ + ::type::is_polymorphic::value \ + ); \ + /**/ + +// the default list of archives types for which code id generated +#define BOOST_CLASS_EXPORT_GUID(T, K) \ + BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST( \ + T, \ + K, \ + boost::archive::detail::known_archive_types::type \ + ) \ + /**/ + +// the default exportable class identifier is the class name +#define BOOST_CLASS_EXPORT_ARCHIVE_LIST(T, ASEQ) \ + BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST(T, BOOST_PP_STRINGIZE(T), A) + +// the default exportable class identifier is the class name +// the default list of archives types for which code id generated +// are the originally included with this serialization system +#define BOOST_CLASS_EXPORT(T) \ + BOOST_CLASS_EXPORT_GUID_ARCHIVE_LIST( \ + T, \ + BOOST_PP_STRINGIZE(T), \ + boost::archive::detail::known_archive_types::type \ + ) \ + /**/ + +#endif // BOOST_SERIALIZATION_EXPORT_HPP