Boost logo

Boost-Commit :

From: ramey_at_[hidden]
Date: 2007-11-27 01:18:32


Author: ramey
Date: 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
New Revision: 41411
URL: http://svn.boost.org/trac/boost/changeset/41411

Log:
failing only two tests in gcc! Unfortunately, fixing the error requires extended type info to be a little bit more elaborate. So I'm doing a check in now
Text files modified:
   branches/serialization_next_release/boost/boost/serialization/export.hpp | 23 ++++++++------
   branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp | 21 ++++++++++++-
   branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp | 63 ++++++++++++++++++++++++++++++---------
   branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp | 35 +++++++++++++++++++---
   branches/serialization_next_release/boost/boost/serialization/force_include.hpp | 4 --
   branches/serialization_next_release/boost/boost/serialization/void_cast.hpp | 1
   6 files changed, 110 insertions(+), 37 deletions(-)

Modified: branches/serialization_next_release/boost/boost/serialization/export.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/export.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/export.hpp 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
@@ -48,8 +48,11 @@
 
 class basic_pointer_iserializer;
 class basic_pointer_oserializer;
-class basic_iserializer;
-class basic_oserializer;
+
+template<class Archive, class T>
+class pointer_iserializer;
+template<class Archive, class T>
+class pointer_oserializer;
 
 template <class Archive, class Serializable>
 struct export_impl
@@ -106,7 +109,7 @@
     );
 
     export_impl<Archive,Serializable>::enable_load(
- BOOST_DEDUCED_TYPENAME Archive::is_loading::type::type()
+ BOOST_DEDUCED_TYPENAME Archive::is_loading()
     );
 }
 
@@ -114,12 +117,6 @@
 struct guid_initializer
 {
     const guid_initializer & export_guid(char const* key, mpl::false_){
- BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value);
- assert(NULL != key);
- boost::serialization::singleton<
- boost::serialization::type_info_implementation<T>::type
- >::get_mutable_instance().key_register(key);
-
         // generates the statically-initialized objects whose constructors
         // register the information allowing serialization of T objects
         // through pointers to their base classes.
@@ -130,10 +127,16 @@
         return *this;
     }
     const guid_initializer & export_guid(char const* key){
+ BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value);
+ assert(NULL != key);
+ boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_mutable_instance().key_register(key);
         // note: exporting an abstract base class will have no effect
         // and cannot be used to instantitiate serialization code
         // (one might be using this in a DLL to instantiate code)
- BOOST_STATIC_WARNING(! boost::is_abstract<T>::value);
+ //BOOST_STATIC_WARNING(! boost::is_abstract<T>::value);
         return export_guid(key, serialization::is_abstract<T>());
     }
 };

Modified: branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
@@ -18,6 +18,7 @@
 
 // for now, extended type info is part of the serialization libraries
 // this could change in the future.
+#include <cstdarg>
 #include <boost/config.hpp>
 #include <boost/serialization/config.hpp>
 
@@ -40,14 +41,22 @@
     // included in implementation of sets and maps.
     const unsigned int m_type_info_key;
     virtual bool
- less_than(const extended_type_info &rhs) const = 0;
+ is_less_than(const extended_type_info &rhs) const {
+ assert(false);
+ return false;
+ };
+ virtual bool
+ is_equal(const extended_type_info &rhs) const {
+ assert(false);
+ return false;
+ };
     void key_unregister();
 protected:
     const char * m_key;
     // this class can't be used as is. It's just the
     // common functionality for all type_info replacement
     // systems. Hence, make these protected
- extended_type_info(const unsigned int type_info_key);
+ extended_type_info(const unsigned int type_info_key = 0);
     // account for bogus gcc warning
     #if defined(__GNUC__)
     virtual
@@ -64,6 +73,14 @@
         return !(operator==(rhs));
     }
     static const extended_type_info * find(const char *key);
+ // for plugins
+ virtual void * construct(unsigned int count = 0, ...) const {
+ assert(false); // must be implemented if used
+ return NULL;
+ };
+ virtual void destroy(void const * const p) const {
+ assert(false); // must be implemented if used
+ }
 };
 
 } // namespace serialization

Modified: branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
@@ -1,5 +1,6 @@
 #ifndef BOOST_EXTENDED_TYPE_INFO_NO_RTTI_HPP
 #define BOOST_EXTENDED_TYPE_INFO_NO_RTTI_HPP
+
 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
 // MS compatible compilers support #pragma once
 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -17,13 +18,13 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 #include <cassert>
+
 #include <boost/config.hpp>
 #include <boost/static_assert.hpp>
-#include <boost/type_traits/is_const.hpp>
 
-#include <boost/serialization/extended_type_info.hpp>
 #include <boost/serialization/singleton.hpp>
-#include <boost/mpl/bool.hpp>
+#include <boost/serialization/extended_type_info.hpp>
+#include <boost/serialization/factory.hpp>
 
 #include <boost/config/abi_prefix.hpp> // must be the last header
 #ifdef BOOST_MSVC
@@ -31,29 +32,37 @@
 # pragma warning(disable : 4251 4231 4660 4275)
 #endif
 
-#define EXTENDED_TYPE_INFO_NO_RTTI_KEY 2
-
 namespace boost {
 namespace serialization {
 ///////////////////////////////////////////////////////////////////////
 // define a special type_info that doesn't depend on rtti which is not
 // available in all situations.
 
+namespace detail {
+
+// common base class to share type_info_key. This is used to
+// identify the method used to keep track of the extended type
+class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info_no_rtti_0 :
+ public extended_type_info
+{
+protected:
+ extended_type_info_no_rtti_0();
+ ~extended_type_info_no_rtti_0();
+public:
+ virtual bool
+ is_less_than(const boost::serialization::extended_type_info &rhs) const ;
+ virtual bool
+ is_equal(const boost::serialization::extended_type_info &rhs) const ;
+};
+
+} // detail
+
 template<class T>
 class extended_type_info_no_rtti :
- public extended_type_info,
+ public detail::extended_type_info_no_rtti_0,
     public singleton<extended_type_info_no_rtti<T> >
 {
 public:
- virtual bool
- less_than(const extended_type_info &rhs) const;
- /*static*/ const extended_type_info *
- get_extended_type_info(const std::type_info & ti) const;
-
- extended_type_info_no_rtti() :
- extended_type_info(EXTENDED_TYPE_INFO_NO_RTTI_KEY)
- {}
- ~extended_type_info_no_rtti(){};
     const extended_type_info *
     get_derived_extended_type_info(const T & t) const {
         // find the type that corresponds to the most derived type.
@@ -65,6 +74,30 @@
         assert(NULL != derived_key);
         return boost::serialization::extended_type_info::find(derived_key);
     }
+ void * construct(unsigned int count, ...) const{
+ // count up the arguments
+ std::va_list ap;
+ va_start(ap, count);
+ switch(count){
+ case 0:
+ return factory<T, 0>(ap);
+ case 1:
+ return factory<T, 1>(ap);
+ case 2:
+ return factory<T, 2>(ap);
+ case 3:
+ return factory<T, 3>(ap);
+ case 4:
+ return factory<T, 4>(ap);
+ default:
+ assert(false); // too many arguments
+ // throw exception here?
+ return NULL;
+ }
+ }
+ void destroy(void const * const p) const{
+ delete static_cast<T const *>(p) ;
+ }
 };
 
 } // namespace serialization

Modified: branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
@@ -19,18 +19,17 @@
 // See http://www.boost.org for updates, documentation, and revision history.
 
 #include <typeinfo>
+#include <cstdarg>
+
 #include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
 
-//#include <boost/static_warning.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/static_warning.hpp>
-#include <boost/type_traits/is_const.hpp>
 #include <boost/type_traits/is_polymorphic.hpp>
-#include <boost/preprocessor/stringize.hpp>
 
 #include <boost/serialization/singleton.hpp>
 #include <boost/serialization/extended_type_info.hpp>
+#include <boost/serialization/factory.hpp>
 
 #include <boost/config/abi_prefix.hpp> // must be the last header
 #ifdef BOOST_MSVC
@@ -55,7 +54,9 @@
     get_extended_type_info(const std::type_info & ti) const;
 public:
     virtual bool
- less_than(const extended_type_info &rhs) const;
+ is_less_than(const extended_type_info &rhs) const;
+ virtual bool
+ is_equal(const extended_type_info &rhs) const;
     const std::type_info & get_typeid() const {
         return *m_ti;
     }
@@ -91,6 +92,30 @@
                 typeid(t)
             );
     }
+ void * construct(unsigned int count, ...) const{
+ // count up the arguments
+ std::va_list ap;
+ va_start(ap, count);
+ switch(count){
+ case 0:
+ return factory<T, 0>(ap);
+ case 1:
+ return factory<T, 1>(ap);
+ case 2:
+ return factory<T, 2>(ap);
+ case 3:
+ return factory<T, 3>(ap);
+ case 4:
+ return factory<T, 4>(ap);
+ default:
+ assert(false); // too many arguments
+ // throw exception here?
+ return NULL;
+ }
+ }
+ void destroy(void const * const p) const{
+ delete static_cast<T const *>(p) ;
+ }
 };
 
 } // namespace serialization

Modified: branches/serialization_next_release/boost/boost/serialization/force_include.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/force_include.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/force_include.hpp 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
@@ -16,10 +16,6 @@
 
 // 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 <boost/config.hpp>
 
 // the following help macro is to guarentee that certain coded

Modified: branches/serialization_next_release/boost/boost/serialization/void_cast.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/void_cast.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/void_cast.hpp 2007-11-27 01:18:31 EST (Tue, 27 Nov 2007)
@@ -21,7 +21,6 @@
 #include <boost/serialization/singleton.hpp>
 #include <boost/serialization/force_include.hpp>
 #include <boost/serialization/type_info_implementation.hpp>
-
 #include <boost/serialization/config.hpp>
 #include <boost/config/abi_prefix.hpp> // must be the last header
 


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