|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51330 - in trunk/boost: archive/detail serialization
From: ramey_at_[hidden]
Date: 2009-02-19 11:07:16
Author: ramey
Date: 2009-02-19 11:07:16 EST (Thu, 19 Feb 2009)
New Revision: 51330
URL: http://svn.boost.org/trac/boost/changeset/51330
Log:
Adjustment to support export for SUN
Correction to extended_type_info implementation
Text files modified:
trunk/boost/archive/detail/register_archive.hpp | 43 +++++++++++++++++++++++++++++++++++++++
trunk/boost/serialization/array.hpp | 3 --
trunk/boost/serialization/export.hpp | 12 ++++++----
trunk/boost/serialization/extended_type_info.hpp | 5 ++-
4 files changed, 52 insertions(+), 11 deletions(-)
Modified: trunk/boost/archive/detail/register_archive.hpp
==============================================================================
--- trunk/boost/archive/detail/register_archive.hpp (original)
+++ trunk/boost/archive/detail/register_archive.hpp 2009-02-19 11:07:16 EST (Thu, 19 Feb 2009)
@@ -28,6 +28,47 @@
typedef int type;
};
+#ifdef __SUNPRO_CC
+
+template<int N>
+struct counter : counter<N-1> {};
+template<>
+struct counter<0> {};
+
+template<class Serializable>
+void instantiate_ptr_serialization(Serializable* s, int, adl_tag) {
+ instantiate_ptr_serialization(s, counter<20>());
+}
+
+template<class Archive>
+struct get_counter {
+ static const int value = sizeof(adjust_counter(counter<20>()));
+ typedef counter<value> type;
+ typedef counter<value - 1> prior;
+ typedef char (&next)[value+1];
+};
+
+char adjust_counter(counter<0>);
+template<class Serializable>
+void instantiate_ptr_serialization(Serializable*, counter<0>) {}
+
+#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \
+namespace boost { namespace archive { namespace detail { \
+ get_counter<Archive>::next adjust_counter(get_counter<Archive>::type);\
+ template<class Serializable> \
+ void instantiate_ptr_serialization(Serializable* s, \
+ get_counter<Archive>::type) { \
+ ptr_serialization_support<Archive, Serializable> x; \
+ instantiate_ptr_serialization(s, get_counter<Archive>::prior()); \
+ }\
+}}}
+
+
+#else
+
+ // This function gets called, but its only purpose is to participate
+ // in overload resolution with the functions declared by
+ // BOOST_SERIALIZATION_REGISTER_ARCHIVE, below.
// This function gets called, but its only purpose is to participate
// in overload resolution with the functions declared by
// BOOST_SERIALIZATION_REGISTER_ARCHIVE, below.
@@ -47,7 +88,7 @@
instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \
\
}}}
-
+#endif
}}} // namespace boost::archive::detail
#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP
Modified: trunk/boost/serialization/array.hpp
==============================================================================
--- trunk/boost/serialization/array.hpp (original)
+++ trunk/boost/serialization/array.hpp 2009-02-19 11:07:16 EST (Thu, 19 Feb 2009)
@@ -106,7 +106,6 @@
return m_element_count;
}
-
private:
value_type* m_t;
std::size_t const m_element_count;
@@ -121,9 +120,7 @@
return array<T>(t, s);
}
-
template <class Archive, class T, std::size_t N>
-
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
{
ar & boost::serialization::make_nvp("elems",a.elems);
Modified: trunk/boost/serialization/export.hpp
==============================================================================
--- trunk/boost/serialization/export.hpp (original)
+++ trunk/boost/serialization/export.hpp 2009-02-19 11:07:16 EST (Thu, 19 Feb 2009)
@@ -86,7 +86,7 @@
template <class Archive, class Serializable>
struct ptr_serialization_support
{
-# if defined(BOOST_MSVC)
+# if defined(BOOST_MSVC) || defined(__SUNPRO_CC)
virtual BOOST_DLLEXPORT void instantiate() BOOST_USED;
# elif defined(__BORLANDC__)
static BOOST_DLLEXPORT void instantiate() BOOST_USED;
@@ -118,6 +118,8 @@
);
}
+namespace {
+
template<class T>
struct guid_initializer
{
@@ -149,6 +151,7 @@
template<typename T>
struct init_guid;
+} // anonymous
} // namespace detail
} // namespace archive
} // namespace boost
@@ -162,12 +165,12 @@
static ::boost::archive::detail::guid_initializer< T > const \
& guid_initializer; \
}; \
- }}} \
::boost::archive::detail::guid_initializer< T > const & \
::boost::archive::detail::init_guid< T >::guid_initializer = \
::boost::serialization::singleton< \
::boost::archive::detail::guid_initializer< T > \
>::get_mutable_instance().export_guid(K); \
+ }}} \
/**/
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
@@ -178,10 +181,9 @@
// relationships for exported classes. On all other compilers, use of
// this macro is entirely optional.
# define BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(Base,Derived) \
-namespace \
-{ \
+namespace { \
static int BOOST_PP_CAT(boost_serialization_mwerks_init_, __LINE__) = \
- (::boost::archive::detail::instantiate_ptr_serialization((Derived*)0,0), 3); \
+ (::boost::archive::detail::instantiate_ptr_serialization((Derived*)0,0), 3); \
static int BOOST_PP_CAT(boost_serialization_mwerks_init2_, __LINE__) = ( \
::boost::serialization::void_cast_register((Derived*)0,(Base*)0) \
, 3); \
Modified: trunk/boost/serialization/extended_type_info.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info.hpp (original)
+++ trunk/boost/serialization/extended_type_info.hpp 2009-02-19 11:07:16 EST (Thu, 19 Feb 2009)
@@ -22,6 +22,7 @@
#include <cassert>
#include <cstddef> // NULL
#include <boost/config.hpp>
+#include <boost/noncopyable.hpp>
#include <boost/serialization/config.hpp>
#include <boost/config/abi_prefix.hpp> // must be the last header
@@ -34,8 +35,8 @@
namespace boost {
namespace serialization {
-
-class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info
+class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info :
+ private boost::noncopyable
{
private:
// used to uniquely identify the type of class derived from this one
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk