|
Boost-Commit : |
From: ramey_at_[hidden]
Date: 2008-03-18 01:53:12
Author: ramey
Date: 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
New Revision: 43694
URL: http://svn.boost.org/trac/boost/changeset/43694
Log:
Support serialization in DLLS
Make thread-safe
fix portable binary archives
Added:
trunk/boost/archive/xml_archive_exception.hpp (contents, props changed)
Removed:
trunk/boost/archive/detail/polymorphic_iarchive_dispatch.hpp
trunk/boost/archive/detail/polymorphic_oarchive_dispatch.hpp
Text files modified:
trunk/boost/archive/basic_archive.hpp | 4
trunk/boost/archive/basic_binary_iarchive.hpp | 2
trunk/boost/archive/basic_binary_iprimitive.hpp | 9 +
trunk/boost/archive/basic_binary_oarchive.hpp | 6
trunk/boost/archive/basic_binary_oprimitive.hpp | 6
trunk/boost/archive/basic_streambuf_locale_saver.hpp | 3
trunk/boost/archive/basic_text_iprimitive.hpp | 4
trunk/boost/archive/basic_text_oarchive.hpp | 2
trunk/boost/archive/basic_text_oprimitive.hpp | 6
trunk/boost/archive/basic_xml_archive.hpp | 35 ------
trunk/boost/archive/binary_iarchive_impl.hpp | 2
trunk/boost/archive/binary_oarchive_impl.hpp | 2
trunk/boost/archive/codecvt_null.hpp | 5
trunk/boost/archive/detail/archive_pointer_iserializer.hpp | 3
trunk/boost/archive/detail/archive_pointer_oserializer.hpp | 3
trunk/boost/archive/detail/auto_link_archive.hpp | 33 +++---
trunk/boost/archive/detail/basic_iarchive.hpp | 19 +-
trunk/boost/archive/detail/basic_iserializer.hpp | 17 +-
trunk/boost/archive/detail/basic_oarchive.hpp | 3
trunk/boost/archive/detail/basic_oserializer.hpp | 10
trunk/boost/archive/detail/basic_pointer_iserializer.hpp | 6
trunk/boost/archive/detail/basic_pointer_oserializer.hpp | 8
trunk/boost/archive/detail/basic_serializer.hpp | 11 +
trunk/boost/archive/detail/basic_serializer_map.hpp | 28 +---
trunk/boost/archive/detail/interface_iarchive.hpp | 11 -
trunk/boost/archive/detail/interface_oarchive.hpp | 13 +-
trunk/boost/archive/detail/iserializer.hpp | 133 ++++++++-----------------
trunk/boost/archive/detail/oserializer.hpp | 210 ++++++++++++++++-----------------------
trunk/boost/archive/detail/register_archive.hpp | 2
trunk/boost/archive/impl/archive_pointer_iserializer.ipp | 46 +++++---
trunk/boost/archive/impl/archive_pointer_oserializer.ipp | 50 ++++++---
trunk/boost/archive/impl/basic_binary_iarchive.ipp | 1
trunk/boost/archive/impl/basic_binary_iprimitive.ipp | 7 +
trunk/boost/archive/impl/basic_binary_oprimitive.ipp | 5
trunk/boost/archive/impl/basic_text_iarchive.ipp | 1
trunk/boost/archive/impl/basic_text_iprimitive.ipp | 9 +
trunk/boost/archive/impl/basic_text_oprimitive.ipp | 7 +
trunk/boost/archive/impl/basic_xml_iarchive.ipp | 1
trunk/boost/archive/impl/basic_xml_oarchive.ipp | 13 +
trunk/boost/archive/impl/text_iarchive_impl.ipp | 2
trunk/boost/archive/impl/xml_iarchive_impl.ipp | 2
trunk/boost/archive/impl/xml_wiarchive_impl.ipp | 2
trunk/boost/archive/iterators/insert_linebreaks.hpp | 2
trunk/boost/archive/iterators/remove_whitespace.hpp | 2
trunk/boost/archive/polymorphic_binary_iarchive.hpp | 6
trunk/boost/archive/polymorphic_binary_oarchive.hpp | 4
trunk/boost/archive/polymorphic_iarchive.hpp | 7
trunk/boost/archive/polymorphic_oarchive.hpp | 7
trunk/boost/archive/polymorphic_text_iarchive.hpp | 6
trunk/boost/archive/polymorphic_text_oarchive.hpp | 4
trunk/boost/archive/polymorphic_text_wiarchive.hpp | 4
trunk/boost/archive/polymorphic_text_woarchive.hpp | 4
trunk/boost/archive/polymorphic_xml_iarchive.hpp | 6
trunk/boost/archive/polymorphic_xml_oarchive.hpp | 4
trunk/boost/archive/polymorphic_xml_wiarchive.hpp | 4
trunk/boost/archive/polymorphic_xml_woarchive.hpp | 4
trunk/boost/archive/shared_ptr_helper.hpp | 9 +
trunk/boost/archive/xml_wiarchive.hpp | 2
trunk/boost/archive/xml_woarchive.hpp | 2
59 files changed, 385 insertions(+), 434 deletions(-)
Modified: trunk/boost/archive/basic_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_archive.hpp (original)
+++ trunk/boost/archive/basic_archive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -86,8 +86,8 @@
no_header = 1, // suppress archive header info
no_codecvt = 2, // suppress alteration of codecvt facet
no_xml_tag_checking = 4, // suppress checking of xml tags
- no_tracking = 8 // suppress ALL tracking
-// no_object_creation = 16 // don't create any new objects
+ no_tracking = 8, // suppress ALL tracking
+ flags_last = 8
};
#define NULL_POINTER_TAG class_id_type(-1)
Modified: trunk/boost/archive/basic_binary_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_iarchive.hpp (original)
+++ trunk/boost/archive/basic_binary_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -59,7 +59,7 @@
typedef array::iarchive<Archive> array_iarchive;
template<class T>
void load_override(T & t, BOOST_PFTO int){
- this->array_iarchive::load_override(t, 0);
+ this->array_iarchive::load_override(t, 0L);
}
// binary files don't include the optional information
void load_override(class_id_optional_type & /* t */, int){}
Modified: trunk/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_binary_iprimitive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -6,6 +6,10 @@
# pragma once
#endif
+#if defined(_MSC_VER)
+#pragma warning( disable : 4800 )
+#endif
+
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_binary_iprimitive.hpp
//
@@ -72,8 +76,11 @@
Archive * This(){
return static_cast<Archive *>(this);
}
+
+ #ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
+ #endif
// main template for serilization of primitive types
template<class T>
@@ -158,7 +165,7 @@
boost::throw_exception(
archive_exception(archive_exception::stream_error)
);
- std::memcpy(address, &t, s);
+ std::memcpy(static_cast<char*>(address) + (count - s), &t, s);
}
}
Modified: trunk/boost/archive/basic_binary_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_oarchive.hpp (original)
+++ trunk/boost/archive/basic_binary_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -61,12 +61,14 @@
typedef array::oarchive<Archive> array_oarchive;
template<class T>
void save_override(const T & t, BOOST_PFTO int){
- this->array_oarchive::save_override(t, 0);
+ this->array_oarchive::save_override(t, 0L);
}
+ /*
template<class T>
void save_override(T & t, BOOST_PFTO int){
- this->save_override(const_cast<const T &>(t), 0);
+ this->save_override(const_cast<const T &>(t), 0L);
}
+ */
// binary files don't include the optional information
void save_override(const class_id_optional_type & /* t */, int){}
Modified: trunk/boost/archive/basic_binary_oprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_oprimitive.hpp (original)
+++ trunk/boost/archive/basic_binary_oprimitive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -71,9 +71,10 @@
Archive * This(){
return static_cast<Archive *>(this);
}
+ #ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<std::locale> archive_locale;
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
-
+ #endif
// default saving of primitives.
template<class T>
void save(const T & t)
@@ -87,8 +88,7 @@
// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.
void save(const bool t){
- int i = t;
- assert(0 == i || 1 == i);
+ assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
save_binary(& t, sizeof(t));
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Modified: trunk/boost/archive/basic_streambuf_locale_saver.hpp
==============================================================================
--- trunk/boost/archive/basic_streambuf_locale_saver.hpp (original)
+++ trunk/boost/archive/basic_streambuf_locale_saver.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -25,14 +25,13 @@
// See <http://www.boost.org/libs/io/> for the library's home page.
#ifndef BOOST_NO_STD_LOCALE
+
#include <locale> // for std::locale
-#endif
#include <streambuf> // for std::basic_streambuf
namespace boost{
namespace archive{
-#ifndef BOOST_NO_STD_LOCALE
template < typename Ch, class Tr >
class basic_streambuf_locale_saver
{
Modified: trunk/boost/archive/basic_text_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_iprimitive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -68,10 +68,14 @@
IStream &is;
io::ios_flags_saver flags_saver;
io::ios_precision_saver precision_saver;
+
+ #ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<std::locale> archive_locale;
io::basic_ios_locale_saver<
BOOST_DEDUCED_TYPENAME IStream::char_type, BOOST_DEDUCED_TYPENAME IStream::traits_type
> locale_saver;
+ #endif
+
template<class T>
void load(T & t)
{
Modified: trunk/boost/archive/basic_text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oarchive.hpp (original)
+++ trunk/boost/archive/basic_text_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -38,7 +38,7 @@
namespace archive {
/////////////////////////////////////////////////////////////////////////
-// class basic_text_iarchive - read serialized objects from a input text stream
+// class basic_text_oarchive
template<class Archive>
class basic_text_oarchive :
public detail::common_oarchive<Archive>
Modified: trunk/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_oprimitive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -71,10 +71,13 @@
OStream &os;
io::ios_flags_saver flags_saver;
io::ios_precision_saver precision_saver;
+
+ #ifndef BOOST_NO_STD_LOCALE
boost::scoped_ptr<std::locale> archive_locale;
io::basic_ios_locale_saver<
BOOST_DEDUCED_TYPENAME OStream::char_type, BOOST_DEDUCED_TYPENAME OStream::traits_type
> locale_saver;
+ #endif
// default saving of primitives.
template<class T>
@@ -89,8 +92,7 @@
void save(const bool t){
// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.
- int i = t;
- assert(0 == i || 1 == i);
+ assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
if(os.fail())
boost::throw_exception(archive_exception(archive_exception::stream_error));
os << t;
Modified: trunk/boost/archive/basic_xml_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_xml_archive.hpp (original)
+++ trunk/boost/archive/basic_xml_archive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -24,41 +24,6 @@
namespace boost {
namespace archive {
-//////////////////////////////////////////////////////////////////////
-// exceptions thrown by xml archives
-//
-class xml_archive_exception :
- public virtual archive_exception
-{
-public:
- typedef enum {
- xml_archive_parsing_error, // see save_register
- xml_archive_tag_mismatch,
- xml_archive_tag_name_error
- } exception_code;
- xml_archive_exception(exception_code c)
- {}
- virtual const char *what( ) const throw( )
- {
- const char *msg;
- switch(code){
- case xml_archive_parsing_error:
- msg = "unrecognized XML syntax";
- break;
- case xml_archive_tag_mismatch:
- msg = "XML start/end tag mismatch";
- break;
- case xml_archive_tag_name_error:
- msg = "Invalid XML tag name";
- break;
- default:
- msg = archive_exception::what();
- break;
- }
- return msg;
- }
-};
-
// constant strings used in xml i/o
extern
Modified: trunk/boost/archive/binary_iarchive_impl.hpp
==============================================================================
--- trunk/boost/archive/binary_iarchive_impl.hpp (original)
+++ trunk/boost/archive/binary_iarchive_impl.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -42,7 +42,7 @@
// make this protected so it can be called from a derived archive
template<class T>
void load_override(T & t, BOOST_PFTO int){
- basic_binary_iarchive<Archive>::load_override(t, 0);
+ this->basic_binary_iarchive<Archive>::load_override(t, 0L);
}
void init(unsigned int flags){
if(0 != (flags & no_header))
Modified: trunk/boost/archive/binary_oarchive_impl.hpp
==============================================================================
--- trunk/boost/archive/binary_oarchive_impl.hpp (original)
+++ trunk/boost/archive/binary_oarchive_impl.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -42,7 +42,7 @@
// make this protected so it can be called from a derived archive
template<class T>
void save_override(T & t, BOOST_PFTO int){
- basic_binary_oarchive<Archive>::save_override(t, 0);
+ this->basic_binary_oarchive<Archive>::save_override(t, 0L);
}
void init(unsigned int flags) {
if(0 != (flags & no_header))
Modified: trunk/boost/archive/codecvt_null.hpp
==============================================================================
--- trunk/boost/archive/codecvt_null.hpp (original)
+++ trunk/boost/archive/codecvt_null.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,6 +18,7 @@
#include <locale>
#include <cstddef>
+#include <wchar.h> // for mbstate_t
#include <boost/config.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
@@ -59,7 +60,7 @@
template<>
class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
{
- virtual BOOST_ARCHIVE_DECL(std::codecvt_base::result)
+ virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result)
do_out(
std::mbstate_t & state,
const wchar_t * first1,
@@ -69,7 +70,7 @@
char * last2,
char * & next2
) const;
- virtual BOOST_ARCHIVE_DECL(std::codecvt_base::result)
+ virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result)
do_in(
std::mbstate_t & state,
const char * first1,
Modified: trunk/boost/archive/detail/archive_pointer_iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/archive_pointer_iserializer.hpp (original)
+++ trunk/boost/archive/detail/archive_pointer_iserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -76,8 +76,7 @@
// type_info. returns NULL if there is no such instance. This
// would indicate that the no object of the specified type was loaded
// any where in the code.
- static
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_iserializer *)
+ static BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_iserializer *)
find(
const boost::serialization::extended_type_info & eti
);
Modified: trunk/boost/archive/detail/archive_pointer_oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/archive_pointer_oserializer.hpp (original)
+++ trunk/boost/archive/detail/archive_pointer_oserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -51,8 +51,7 @@
// type_info. returns NULL, if there is no such instance. This
// would indicate that the no object of the specified type was saved
// any where in the code.
- static
- BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_oserializer *)
+ static BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_pointer_oserializer *)
find(
const boost::serialization::extended_type_info & eti
);
Modified: trunk/boost/archive/detail/auto_link_archive.hpp
==============================================================================
--- trunk/boost/archive/detail/auto_link_archive.hpp (original)
+++ trunk/boost/archive/detail/auto_link_archive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -25,23 +25,24 @@
#include <boost/archive/detail/decl.hpp>
-#if !defined(BOOST_ARCHIVE_SOURCE) \
-&& !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB)
+#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \
+&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \
+&& !defined(BOOST_SERIALIZATION_SOURCE)
-// Set the name of our library, this will get undef'ed by auto_link.hpp
-// once it's done with it:
-//
-#define BOOST_LIB_NAME boost_serialization
-//
-// If we're importing code from a dll, then tell auto_link.hpp about it:
-//
-#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
-# define BOOST_DYN_LINK
-#endif
-//
-// And include the header that does the work:
-//
-#include <boost/config/auto_link.hpp>
+ // Set the name of our library, this will get undef'ed by auto_link.hpp
+ // once it's done with it:
+ //
+ #define BOOST_LIB_NAME boost_serialization
+ //
+ // If we're importing code from a dll, then tell auto_link.hpp about it:
+ //
+ #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
+ # define BOOST_DYN_LINK
+ #endif
+ //
+ // And include the header that does the work:
+ //
+ #include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
Modified: trunk/boost/archive/detail/basic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_iarchive.hpp (original)
+++ trunk/boost/archive/detail/basic_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -20,15 +20,12 @@
// #include <boost/scoped_ptr.hpp>
#include <boost/config.hpp>
-#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/tracking_enum.hpp>
-
+#include <boost/archive/basic_archive.hpp>
+#include <boost/archive/detail/decl.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
-template<class T>
-class shared_ptr;
-
namespace serialization {
class extended_type_info;
} // namespace serialization
@@ -66,17 +63,19 @@
// note: NOT part of the public API.
void next_object_pointer(void *t);
void register_basic_serializer(
- const basic_iserializer & bis
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_iserializer & bis
);
void load_object(
void *t,
- const basic_iserializer & bis
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_iserializer & bis
);
- const basic_pointer_iserializer *
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */ basic_pointer_iserializer *
load_pointer(
void * & t,
- const basic_pointer_iserializer * bpis_ptr,
- const basic_pointer_iserializer * (*finder)(
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */
+ basic_pointer_iserializer * bpis_ptr,
+ const /* BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) */
+ basic_pointer_iserializer * (*finder)(
const boost::serialization::extended_type_info & eti
)
);
Modified: trunk/boost/archive/detail/basic_iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_iserializer.hpp (original)
+++ trunk/boost/archive/detail/basic_iserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -16,13 +16,12 @@
// See http://www.boost.org for updates, documentation, and revision history.
-#include <cassert>
#include <cstdlib> // NULL
#include <boost/config.hpp>
-#include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/archive/detail/decl.hpp>
#include <boost/archive/detail/basic_serializer.hpp>
-
+#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@@ -42,10 +41,10 @@
public basic_serializer
{
private:
- basic_pointer_iserializer *bpis;
+ basic_pointer_iserializer *m_bpis;
protected:
explicit basic_iserializer(
- const boost::serialization::extended_type_info & type_
+ const boost::serialization::extended_type_info & type
);
// account for bogus gcc warning
#if defined(__GNUC__)
@@ -54,13 +53,13 @@
~basic_iserializer();
public:
bool serialized_as_pointer() const {
- return bpis != NULL;
+ return m_bpis != NULL;
}
- void set_bpis(basic_pointer_iserializer *bpis_){
- bpis = bpis_;
+ void set_bpis(basic_pointer_iserializer *bpis){
+ m_bpis = bpis;
}
const basic_pointer_iserializer * get_bpis_ptr() const {
- return bpis;
+ return m_bpis;
}
virtual void load_object_data(
basic_iarchive & ar,
Modified: trunk/boost/archive/detail/basic_oarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_oarchive.hpp (original)
+++ trunk/boost/archive/detail/basic_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -28,9 +28,6 @@
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
-template<class T>
-class shared_ptr;
-
namespace serialization {
class extended_type_info;
} // namespace serialization
Modified: trunk/boost/archive/detail/basic_oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_oserializer.hpp (original)
+++ trunk/boost/archive/detail/basic_oserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -41,7 +41,7 @@
public basic_serializer
{
private:
- basic_pointer_oserializer *bpos;
+ basic_pointer_oserializer *m_bpos;
protected:
explicit basic_oserializer(
const boost::serialization::extended_type_info & type_
@@ -53,13 +53,13 @@
~basic_oserializer();
public:
bool serialized_as_pointer() const {
- return bpos != NULL;
+ return m_bpos != NULL;
}
- void set_bpos(basic_pointer_oserializer *bpos_){
- bpos = bpos_;
+ void set_bpos(basic_pointer_oserializer *bpos){
+ m_bpos = bpos;
}
const basic_pointer_oserializer * get_bpos() const {
- return bpos;
+ return m_bpos;
}
virtual void save_object_data(
basic_oarchive & ar, const void * x
Modified: trunk/boost/archive/detail/basic_pointer_iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_pointer_iserializer.hpp (original)
+++ trunk/boost/archive/detail/basic_pointer_iserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -1,5 +1,5 @@
-#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_ISERIALIZER_HPP
-#define BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_ISERIALIZER_HPP
+#ifndef BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
+#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -61,4 +61,4 @@
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-#endif // BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_ISERIALIZER_HPP
+#endif // BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
Modified: trunk/boost/archive/detail/basic_pointer_oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_pointer_oserializer.hpp (original)
+++ trunk/boost/archive/detail/basic_pointer_oserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -1,5 +1,5 @@
-#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_OSERIALIZER_HPP
-#define BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_OSERIALIZER_HPP
+#ifndef BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
+#define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -40,12 +40,12 @@
explicit basic_pointer_oserializer(
const boost::serialization::extended_type_info & type_
);
+public:
// account for bogus gcc warning
#if defined(__GNUC__)
virtual
#endif
~basic_pointer_oserializer();
-public:
virtual const basic_oserializer & get_basic_serializer() const = 0;
virtual void save_object_ptr(
basic_oarchive & ar,
@@ -59,4 +59,4 @@
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-#endif // BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_OSERIALIZER_HPP
+#endif // BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
Modified: trunk/boost/archive/detail/basic_serializer.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_serializer.hpp (original)
+++ trunk/boost/archive/detail/basic_serializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -34,7 +34,9 @@
const boost::serialization::extended_type_info & eti
) :
m_eti(eti)
- {}
+ {
+ assert(NULL != & eti);
+ }
public:
const boost::serialization::extended_type_info & get_eti() const {
return m_eti;
@@ -44,6 +46,13 @@
}
};
+class basic_serializer_arg : public basic_serializer {
+public:
+ basic_serializer_arg(const serialization::extended_type_info & eti) :
+ basic_serializer(eti)
+ {}
+};
+
} // namespace detail
} // namespace archive
} // namespace boost
Modified: trunk/boost/archive/detail/basic_serializer_map.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_serializer_map.hpp (original)
+++ trunk/boost/archive/detail/basic_serializer_map.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -38,28 +38,16 @@
{
bool operator()(
const basic_serializer * lhs, const basic_serializer * rhs
- ) const ;
-};
-
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer_map : public
- boost::noncopyable
-{
- typedef std::set<const basic_serializer *, type_info_pointer_compare> map_type;
- map_type m_map;
- bool & m_deleted;
-public:
- bool insert(const basic_serializer * bs);
- const basic_serializer * tfind(
- const boost::serialization::extended_type_info & type_
- ) const;
- void erase(basic_serializer * bs);
- basic_serializer_map(bool & deleted);
- ~basic_serializer_map();
-private:
- // cw 8.3 requires this
- basic_serializer_map& operator=(basic_serializer_map const&);
+ ) const {
+ return *lhs < *rhs;
+ }
};
+typedef BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) std::set<
+ const basic_serializer *,
+ type_info_pointer_compare
+> basic_serializer_map;
+
} // namespace detail
} // namespace archive
} // namespace boost
Modified: trunk/boost/archive/detail/interface_iarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/interface_iarchive.hpp (original)
+++ trunk/boost/archive/detail/interface_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -20,15 +20,10 @@
#include <boost/mpl/bool.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/iserializer.hpp>
+#include <boost/serialization/singleton.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
-template<class T>
-class shared_ptr;
-namespace serialization {
- class extended_type_info;
-} // namespace serialization
-
namespace archive {
namespace detail {
@@ -54,7 +49,9 @@
const basic_pointer_iserializer *
register_type(T * = NULL){
const basic_pointer_iserializer & bpis =
- pointer_iserializer<Archive, T>::get_instance();
+ boost::serialization::singleton<
+ pointer_iserializer<Archive, T>
+ >::get_const_instance();
this->This()->register_basic_serializer(bpis.get_basic_serializer());
return & bpis;
}
Modified: trunk/boost/archive/detail/interface_oarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/interface_oarchive.hpp (original)
+++ trunk/boost/archive/detail/interface_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -23,12 +23,9 @@
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
-namespace boost {
-template<class T>
-class shared_ptr;
-namespace serialization {
- class extended_type_info;
-} // namespace serialization
+#include <boost/serialization/singleton.hpp>
+
+namespace boost {
namespace archive {
namespace detail {
@@ -54,7 +51,9 @@
const basic_pointer_oserializer *
register_type(const T * = NULL){
const basic_pointer_oserializer & bpos =
- pointer_oserializer<Archive, T>::get_instance();
+ boost::serialization::singleton<
+ pointer_oserializer<Archive, T>
+ >::get_const_instance();
this->This()->register_basic_serializer(bpos.get_basic_serializer());
return & bpos;
}
Modified: trunk/boost/archive/detail/iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/iserializer.hpp (original)
+++ trunk/boost/archive/detail/iserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -40,12 +40,12 @@
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_fundamental.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_all_extents.hpp>
#include <boost/serialization/is_abstract.hpp>
+#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
@@ -67,9 +67,7 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/basic_iserializer.hpp>
#include <boost/archive/detail/archive_pointer_iserializer.hpp>
-#include <boost/archive/detail/dynamically_initialized.hpp>
-#include <boost/serialization/force_include.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/level.hpp>
@@ -79,6 +77,8 @@
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/singleton.hpp>
+
namespace boost {
namespace serialization {
@@ -108,49 +108,40 @@
}
// private constructor to inhibit any existence other than the
// static one
+public:
explicit iserializer() :
basic_iserializer(
- * boost::serialization::type_info_implementation<T>::type::get_instance()
+ boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance()
)
{}
-public:
- virtual BOOST_DLLEXPORT void load_object_data(
+ virtual void load_object_data(
basic_iarchive & ar,
void *x,
const unsigned int file_version
- ) const BOOST_USED ;
+ ) const;
virtual bool class_info() const {
return boost::serialization::implementation_level<T>::value
>= boost::serialization::object_class_info;
}
virtual bool tracking(const unsigned int /* flags */) const {
-// if(0 != (flags & no_tracking))
-// return false;
return boost::serialization::tracking_level<T>::value
== boost::serialization::track_always
- || boost::serialization::tracking_level<T>::value
+ || ( boost::serialization::tracking_level<T>::value
== boost::serialization::track_selectively
- && serialized_as_pointer();
+ && serialized_as_pointer());
}
virtual unsigned int version() const {
return ::boost::serialization::version<T>::value;
}
virtual bool is_polymorphic() const {
- typedef BOOST_DEDUCED_TYPENAME
- boost::serialization::type_info_implementation<
- T
- >::type::is_polymorphic::type typex;
- return typex::value;
- }
- static iserializer & get_instance(){
- static iserializer instance;
- return instance;
+ return boost::is_polymorphic<T>::value;
}
virtual ~iserializer(){};
};
template<class Archive, class T>
-BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
+void iserializer<Archive, T>::load_object_data(
basic_iarchive & ar,
void *x,
const unsigned int file_version
@@ -167,32 +158,20 @@
template<class Archive, class T>
class pointer_iserializer
: public archive_pointer_iserializer<Archive>
- , public dynamically_initialized<pointer_iserializer<Archive,T> >
{
private:
virtual const basic_iserializer & get_basic_serializer() const {
- return iserializer<Archive, T>::get_instance();
+ return boost::serialization::singleton<
+ iserializer<Archive, T>
+ >::get_const_instance();
}
- virtual BOOST_DLLEXPORT void load_object_ptr(
+ virtual void load_object_ptr(
basic_iarchive & ar,
void * & x,
const unsigned int file_version
- ) const BOOST_USED;
-#if defined(__GNUC__) || ( defined(BOOST_MSVC) && (_MSC_VER <= 1300) )
+ ) const ;
public:
-#endif
- // private constructor to inhibit any existence other than the
- // static one. Note GCC doesn't permit constructor to be private
- BOOST_DLLEXPORT pointer_iserializer() BOOST_USED;
- friend struct dynamically_initialized<pointer_iserializer<Archive,T> >;
-public:
- // at least one compiler (CW) seems to require that serialize_adl
- // be explicitly instantiated. Still under investigation.
- #if !defined(__BORLANDC__)
- void (* const m)(Archive &, T &, const unsigned);
- boost::serialization::extended_type_info * (* e)();
- #endif
- BOOST_DLLEXPORT static const pointer_iserializer & get_instance() BOOST_USED;
+ pointer_iserializer();
};
// note trick to be sure that operator new is using class specific
@@ -266,7 +245,7 @@
};
template<class Archive, class T>
-BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
+void pointer_iserializer<Archive, T>::load_object_ptr(
basic_iarchive & ar,
void * & x,
const unsigned int file_version
@@ -305,29 +284,15 @@
}
template<class Archive, class T>
-#if !defined(__BORLANDC__)
-BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
+pointer_iserializer<Archive, T>::pointer_iserializer() :
archive_pointer_iserializer<Archive>(
- * boost::serialization::type_info_implementation<T>::type::get_instance()
- ),
- m(boost::serialization::serialize_adl<Archive, T>),
- e(boost::serialization::type_info_implementation<T>::type::get_instance)
-#else
-BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
- archive_pointer_iserializer<Archive>(
- * boost::serialization::type_info_implementation<T>::type::get_instance()
+ boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance()
)
-#endif
{
- iserializer<Archive, T> & bis = iserializer<Archive, T>::get_instance();
- bis.set_bpis(this);
-}
-
-template<class Archive, class T>
-BOOST_DLLEXPORT const pointer_iserializer<Archive, T> &
-pointer_iserializer<Archive, T>::get_instance() {
- // note: comeau complains without full qualification
- return dynamically_initialized<pointer_iserializer<Archive,T> >::instance;
+ boost::serialization::singleton<
+ iserializer<Archive, T>
+ >::get_mutable_instance().set_bpis(this);
}
template<class Archive, class T>
@@ -361,7 +326,12 @@
// its not called that way - so fix it her
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<T>::type typex;
void * x = & const_cast<typex &>(t);
- ar.load_object(x, iserializer<Archive, T>::get_instance());
+ ar.load_object(
+ x,
+ boost::serialization::singleton<
+ iserializer<Archive, T>
+ >::get_const_instance()
+ );
}
};
@@ -405,6 +375,11 @@
> > >::type typex;
static void invoke(Archive & ar, T &t){
+ // check that we're not trying to serialize something that
+ // has been marked not to be serialized. If this your program
+ // traps here, you've tried to serialize a class whose trait
+ // has been marked "non-serializable". Either reset the trait
+ // (see level.hpp) or change program not to serialize items of this class
BOOST_STATIC_ASSERT((
mpl::greater_equal<
boost::serialization::implementation_level<T>,
@@ -421,12 +396,8 @@
struct abstract
{
static const basic_pointer_iserializer * register_type(Archive & /* ar */){
- #if ! defined(__BORLANDC__)
- typedef BOOST_DEDUCED_TYPENAME
- boost::serialization::type_info_implementation<T>::type::is_polymorphic typex;
// it has? to be polymorphic
- BOOST_STATIC_ASSERT(typex::value);
- #endif
+ BOOST_STATIC_ASSERT(boost::is_polymorphic<T>::value);
return static_cast<basic_pointer_iserializer *>(NULL);
}
};
@@ -447,7 +418,7 @@
// virtual serialize functions used for plug-ins
typedef BOOST_DEDUCED_TYPENAME
mpl::eval_if<
- serialization::is_abstract<T>,
+ serialization::is_abstract<const T>,
mpl::identity<abstract<T> >,
mpl::identity<non_abstract<T> >
>::type typex;
@@ -464,7 +435,8 @@
return static_cast<T *>(
boost::serialization::void_upcast(
eti,
- * boost::serialization::type_info_implementation<T>::type::get_instance(),
+ boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance(),
t
)
);
@@ -514,27 +486,6 @@
}
};
-#if 0
-// note bogus arguments to workaround msvc 6 silent runtime failure
-template<class Archive, class T>
-BOOST_DLLEXPORT
-inline const basic_pointer_iserializer &
-instantiate_pointer_iserializer(
- Archive * /* ar = NULL */,
- T * /* t = NULL */
-) BOOST_USED;
-
-template<class Archive, class T>
-BOOST_DLLEXPORT
-inline const basic_pointer_iserializer &
-instantiate_pointer_iserializer(
- Archive * /* ar = NULL */,
- T * /* t = NULL */
-){
- return pointer_iserializer<Archive,T>::instance;
-}
-#endif
-
} // detail
template<class Archive, class T>
@@ -572,7 +523,7 @@
// for loading const objects - but I see no alternative
template<class Archive, class T>
inline void load(Archive &ar, const T & t){
- load(ar, const_cast<T &>(t));
+ load(ar, const_cast<T &>(t));
}
#endif
@@ -580,7 +531,7 @@
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template<class Archive, class T>
inline void load_wrapper(Archive &ar, const T&t, mpl::true_){
- boost::archive::load(ar, const_cast<T&>(t));
+ boost::archive::load(ar, const_cast<T&>(t));
}
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
Modified: trunk/boost/archive/detail/oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/oserializer.hpp (original)
+++ trunk/boost/archive/detail/oserializer.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -32,23 +32,23 @@
#include <boost/static_warning.hpp>
#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_fundamental.hpp>
#include <boost/type_traits/is_enum.hpp>
-#include <boost/type_traits/is_volatile.hpp>
+//#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_const.hpp>
-#include <boost/type_traits/is_same.hpp>
+//#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/type_traits/remove_all_extents.hpp>
#include <boost/serialization/is_abstract.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/and.hpp>
-#include <boost/mpl/less.hpp>
+//#include <boost/mpl/less.hpp>
#include <boost/mpl/greater_equal.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/identity.hpp>
-#include <boost/mpl/list.hpp>
-#include <boost/mpl/empty.hpp>
+//#include <boost/mpl/list.hpp>
+//#include <boost/mpl/empty.hpp>
#include <boost/mpl/not.hpp>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
@@ -58,9 +58,7 @@
#include <boost/archive/detail/basic_oarchive.hpp>
#include <boost/archive/detail/basic_oserializer.hpp>
#include <boost/archive/detail/archive_pointer_oserializer.hpp>
-#include <boost/archive/detail/dynamically_initialized.hpp>
-#include <boost/serialization/force_include.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/level.hpp>
@@ -70,6 +68,7 @@
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
+#include <boost/serialization/singleton.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -104,50 +103,43 @@
private:
// private constructor to inhibit any existence other than the
// static one
- explicit BOOST_DLLEXPORT oserializer() :
+public:
+ explicit oserializer() :
basic_oserializer(
- * boost::serialization::type_info_implementation<T>::type::get_instance()
+ boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance()
)
{}
-public:
- virtual BOOST_DLLEXPORT void save_object_data(
+ virtual void save_object_data(
basic_oarchive & ar,
const void *x
- ) const BOOST_USED ;
+ ) const ;
virtual bool class_info() const {
return boost::serialization::implementation_level<T>::value
>= boost::serialization::object_class_info;
}
virtual bool tracking(const unsigned int /* flags */) const {
-// if(0 != (flags & no_tracking))
-// return false;
return boost::serialization::tracking_level<T>::value == boost::serialization::track_always
- || boost::serialization::tracking_level<T>::value == boost::serialization::track_selectively
- && serialized_as_pointer();
+ || (boost::serialization::tracking_level<T>::value == boost::serialization::track_selectively
+ && serialized_as_pointer());
}
virtual unsigned int version() const {
return ::boost::serialization::version<T>::value;
}
virtual bool is_polymorphic() const {
- typedef BOOST_DEDUCED_TYPENAME boost::serialization::type_info_implementation<
- T
- >::type::is_polymorphic::type typex;
- return typex::value;
- }
- static oserializer & get_instance(){
- static oserializer instance;
- return instance;
+ return boost::is_polymorphic<T>::value;
}
virtual ~oserializer(){}
};
template<class Archive, class T>
-BOOST_DLLEXPORT void oserializer<Archive, T>::save_object_data(
+void oserializer<Archive, T>::save_object_data(
basic_oarchive & ar,
const void *x
) const {
// make sure call is routed through the highest interface that might
// be specialized by the user.
+ BOOST_STATIC_ASSERT(boost::is_const<T>::value == false);
boost::serialization::serialize_adl(
boost::smart_cast_reference<Archive &>(ar),
* static_cast<T *>(const_cast<void *>(x)),
@@ -158,35 +150,27 @@
template<class Archive, class T>
class pointer_oserializer
: public archive_pointer_oserializer<Archive>
- , public dynamically_initialized<pointer_oserializer<Archive,T> >
{
+ const basic_oserializer & get_basic_serializer() const;
private:
- virtual const basic_oserializer & get_basic_serializer() const {
- return oserializer<Archive, T>::get_instance();
- }
- virtual BOOST_DLLEXPORT void save_object_ptr(
+ virtual void save_object_ptr(
basic_oarchive & ar,
const void * x
- ) const BOOST_USED ;
-#if defined(__GNUC__) || ( defined(BOOST_MSVC) && (_MSC_VER <= 1300) )
+ ) const ;
public:
-#endif
- // private constructor to inhibit any existence other than the
- // static one. Note GCC doesn't permit constructor to be private
- explicit BOOST_DLLEXPORT pointer_oserializer() BOOST_USED;
- friend struct dynamically_initialized<pointer_oserializer<Archive,T> >;
-public:
- #if !defined(__BORLANDC__)
- // at least one compiler (CW) seems to require that serialize_adl
- // be explicitly instantiated. Still under investigation.
- void (* const m)(Archive &, T &, const unsigned);
- boost::serialization::extended_type_info * (* e)();
- #endif
- BOOST_DLLEXPORT static const pointer_oserializer & get_instance() BOOST_USED;
+ explicit pointer_oserializer();
};
template<class Archive, class T>
-BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
+const basic_oserializer &
+pointer_oserializer<Archive, T>::get_basic_serializer() const {
+ return boost::serialization::singleton<
+ oserializer<Archive, T>
+ >::get_const_instance();
+}
+
+template<class Archive, class T>
+void pointer_oserializer<Archive, T>::save_object_ptr(
basic_oarchive & ar,
const void * x
) const {
@@ -205,30 +189,16 @@
}
template<class Archive, class T>
-#if !defined(__BORLANDC__)
-BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
+pointer_oserializer<Archive, T>::pointer_oserializer() :
archive_pointer_oserializer<Archive>(
- * boost::serialization::type_info_implementation<T>::type::get_instance()
- ),
- m(boost::serialization::serialize_adl<Archive, T>),
- e(boost::serialization::type_info_implementation<T>::type::get_instance)
-#else
-BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
- archive_pointer_oserializer<Archive>(
- * boost::serialization::type_info_implementation<T>::type::get_instance()
+ boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance()
)
-#endif
{
// make sure appropriate member function is instantiated
- oserializer<Archive, T> & bos = oserializer<Archive, T>::get_instance();
- bos.set_bpos(this);
-}
-
-template<class Archive, class T>
-BOOST_DLLEXPORT const pointer_oserializer<Archive, T> &
-pointer_oserializer<Archive, T>::get_instance() {
- // note: comeau complains without full qualification
- return dynamically_initialized<pointer_oserializer<Archive,T> >::instance;
+ boost::serialization::singleton<
+ oserializer<Archive, T>
+ >::get_mutable_instance().set_bpos(this);
}
template<class Archive, class T>
@@ -256,7 +226,12 @@
// serialization level and class version
struct save_standard {
static void invoke(Archive &ar, const T & t){
- ar.save_object(& t, oserializer<Archive, T>::get_instance());
+ ar.save_object(
+ & t,
+ boost::serialization::singleton<
+ oserializer<Archive, T>
+ >::get_const_instance()
+ );
}
};
@@ -300,7 +275,7 @@
// else
// do a fast save only tracking is turned off
mpl::identity<save_conditional>
- > > >::type typex;
+ > > >::type typex;
static void invoke(Archive & ar, const T & t){
// check that we're not trying to serialize something that
@@ -325,10 +300,8 @@
{
static const basic_pointer_oserializer * register_type(Archive & /* ar */){
// it has? to be polymorphic
- BOOST_STATIC_ASSERT(
- boost::serialization::type_info_implementation<T>::type::is_polymorphic::value
- );
- return static_cast<const basic_pointer_oserializer *>(NULL);
+ BOOST_STATIC_ASSERT(boost::is_polymorphic<T>::value);
+ return NULL;
}
};
@@ -360,11 +333,14 @@
{
static void save(
Archive &ar,
- const T & t,
- const basic_pointer_oserializer * bpos_ptr
+ T & t
){
+ const basic_pointer_oserializer & bpos =
+ boost::serialization::singleton<
+ pointer_oserializer<Archive, T>
+ >::get_const_instance();
// save the requested pointer type
- ar.save_pointer(& t, bpos_ptr);
+ ar.save_pointer(& t, & bpos);
}
};
@@ -373,18 +349,23 @@
{
static void save(
Archive &ar,
- const T & t,
- const basic_pointer_oserializer * bpos_ptr
+ T & t
){
- const boost::serialization::extended_type_info * this_type
- = boost::serialization::type_info_implementation<T>::type::get_instance();
+ BOOST_DEDUCED_TYPENAME boost::serialization::type_info_implementation<T>::type
+ const & i = boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance();
+
+ boost::serialization::extended_type_info const * const this_type = & i;
+
// retrieve the true type of the object pointed to
// if this assertion fails its an error in this library
assert(NULL != this_type);
- const boost::serialization::extended_type_info * true_type
- = boost::serialization::type_info_implementation<T>::type::get_derived_extended_type_info(t);
+
+ const boost::serialization::extended_type_info * true_type =
+ i.get_derived_extended_type_info(t);
+
// note:if this exception is thrown, be sure that derived pointer
- // is either regsitered or exported.
+ // is either registered or exported.
if(NULL == true_type){
boost::throw_exception(
archive_exception(archive_exception::unregistered_class)
@@ -394,7 +375,8 @@
// if its not a pointer to a more derived type
const void *vp = static_cast<const void *>(&t);
if(*this_type == *true_type){
- ar.save_pointer(vp, bpos_ptr);
+ const basic_pointer_oserializer * bpos = register_type(ar, t);
+ ar.save_pointer(vp, bpos);
return;
}
// convert pointer to more derived type. if this is thrown
@@ -406,32 +388,37 @@
);
}
- // sice true_type is valid, and this only gets made if the
+ // since true_type is valid, and this only gets made if the
// pointer oserializer object has been created, this should never
// fail
- bpos_ptr = archive_pointer_oserializer<Archive>::find(* true_type);
- assert(NULL != bpos_ptr);
- if(NULL == bpos_ptr)
+ const basic_pointer_oserializer * bpos
+ = archive_pointer_oserializer<Archive>::find(* true_type);
+ assert(NULL != bpos);
+ if(NULL == bpos)
boost::throw_exception(
archive_exception(archive_exception::unregistered_class)
);
- ar.save_pointer(vp, bpos_ptr);
+ ar.save_pointer(vp, bpos);
}
};
+ // out of line selector works around borland quirk
template<class T>
- static void save(
- Archive & ar,
- const T &t,
- const basic_pointer_oserializer * bpos_ptr
- ){
+ struct conditional {
typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
- BOOST_DEDUCED_TYPENAME boost::serialization::
- type_info_implementation<T>::type::is_polymorphic,
+ is_polymorphic<T>,
mpl::identity<polymorphic<T> >,
mpl::identity<non_polymorphic<T> >
- >::type typey;
- typey::save(ar, const_cast<T &>(t), bpos_ptr);
+ >::type type;
+ };
+
+ // used to convert TPtr in to a pointer to a T
+ template<class T>
+ static void save(
+ Archive & ar,
+ const T & t
+ ){
+ conditional<T>::type::save(ar, const_cast<T &>(t));
}
template<class T>
@@ -452,14 +439,14 @@
#else
// otherwise remove the const
#endif
- const basic_pointer_oserializer * bpos_ptr = register_type(ar, * t);
+ register_type(ar, * t);
if(NULL == t){
basic_oarchive & boa = boost::smart_cast_reference<basic_oarchive &>(ar);
boa.save_null_pointer();
save_access::end_preamble(ar);
return;
}
- save(ar, * t, bpos_ptr);
+ save(ar, * t);
};
};
@@ -490,27 +477,6 @@
}
};
-
-#if 0
-// note bogus arguments to workaround msvc 6 silent runtime failure
-// declaration to satisfy gcc
-template<class Archive, class T>
-BOOST_DLLEXPORT const basic_pointer_oserializer &
-instantiate_pointer_oserializer(
- Archive * /* ar = NULL */,
- T * /* t = NULL */
-) BOOST_USED ;
-// definition
-template<class Archive, class T>
-BOOST_DLLEXPORT const basic_pointer_oserializer &
-instantiate_pointer_oserializer(
- Archive * /* ar = NULL */,
- T * /* t = NULL */
-){
- return pointer_oserializer<Archive, T>::instance;
-}
-#endif
-
} // detail
template<class Archive, class T>
@@ -561,7 +527,7 @@
// serialization library and should be double checked. See documentation on
// object tracking. Also, see the "rationale" section of the documenation
// for motivation for this checking.
- BOOST_STATIC_ASSERT(check_tracking<T>::value);
+ BOOST_STATIC_WARNING(check_tracking<T>::value);
save(ar, const_cast<const T &>(t));
}
#endif
Deleted: trunk/boost/archive/detail/polymorphic_iarchive_dispatch.hpp
==============================================================================
--- trunk/boost/archive/detail/polymorphic_iarchive_dispatch.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
+++ (empty file)
@@ -1,197 +0,0 @@
-#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP
-#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_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
-// polymorphic_iarchive_dispatch.hpp
-
-// (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 <cstddef>
-#include <string>
-#include <ostream>
-#include <boost/noncopyable.hpp>
-#include <boost/cstdint.hpp>
-
-#include <boost/config.hpp>
-#if defined(BOOST_NO_STDC_NAMESPACE)
-namespace std{
- using ::size_t;
-} // namespace std
-#endif
-
-#include <boost/archive/polymorphic_iarchive.hpp>
-#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
-
-namespace boost {
-template<class T>
-class shared_ptr;
-namespace serialization {
- class extended_type_info;
-} // namespace serialization
-namespace archive {
-namespace detail{
-
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer;
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
-
-template<class ArchiveImplementation>
-class polymorphic_iarchive_dispatch :
- public polymorphic_iarchive,
- // note: gcc dynamic cross cast fails if the the derivation below is
- // not public. I think this is a mistake.
- public /*protected*/ ArchiveImplementation,
- private boost::noncopyable
-{
-private:
- // these are used by the serialization library.
- virtual void load_object(
- void *t,
- const basic_iserializer & bis
- ){
- ArchiveImplementation::load_object(t, bis);
- }
- virtual const basic_pointer_iserializer * load_pointer(
- void * & t,
- const basic_pointer_iserializer * bpis_ptr,
- const basic_pointer_iserializer * (*finder)(
- const boost::serialization::extended_type_info & type
- )
- ){
- return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
- }
- virtual void set_library_version(unsigned int archive_library_version){
- ArchiveImplementation::set_library_version(archive_library_version);
- }
- virtual unsigned int get_library_version() const{
- return ArchiveImplementation::get_library_version();
- }
- virtual unsigned int get_flags() const {
- return ArchiveImplementation::get_flags();
- }
- virtual void delete_created_pointers(){
- ArchiveImplementation::delete_created_pointers();
- }
- virtual void reset_object_address(
- const void * new_address,
- const void * old_address
- ){
- ArchiveImplementation::reset_object_address(new_address, old_address);
- }
- virtual void load_binary(void * t, std::size_t size){
- ArchiveImplementation::load_binary(t, size);
- }
- // primitive types the only ones permitted by polymorphic archives
- virtual void load(bool & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(char & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(signed char & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(unsigned char & t){
- ArchiveImplementation::load(t);
- }
- #ifndef BOOST_NO_CWCHAR
- #ifndef BOOST_NO_INTRINSIC_WCHAR_T
- virtual void load(wchar_t & t){
- ArchiveImplementation::load(t);
- }
- #endif
- #endif
- virtual void load(short & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(unsigned short & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(int & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(unsigned int & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(long & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(unsigned long & t){
- ArchiveImplementation::load(t);
- }
- #if !defined(BOOST_NO_INTRINSIC_INT64_T)
- virtual void load(boost::int64_t & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(boost::uint64_t & t){
- ArchiveImplementation::load(t);
- }
- #endif
- virtual void load(float & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(double & t){
- ArchiveImplementation::load(t);
- }
- virtual void load(std::string & t){
- ArchiveImplementation::load(t);
- }
- #ifndef BOOST_NO_STD_WSTRING
- virtual void load(std::wstring & t){
- ArchiveImplementation::load(t);
- }
- #endif
- // used for xml and other tagged formats default does nothing
- virtual void load_start(const char * name){
- ArchiveImplementation::load_start(name);
- }
- virtual void load_end(const char * name){
- ArchiveImplementation::load_end(name);
- }
-
- virtual void register_basic_serializer(const basic_iserializer & bis){
- ArchiveImplementation::register_basic_serializer(bis);
- }
-public:
- // this can't be inheriteded because they appear in mulitple
- // parents
- typedef mpl::bool_<true> is_loading;
- typedef mpl::bool_<false> is_saving;
- // the >> operator
- template<class T>
- polymorphic_iarchive & operator>>(T & t){
- return polymorphic_iarchive::operator>>(t);
- }
-
- // the & operator
- template<class T>
- polymorphic_iarchive & operator&(T & t){
- return polymorphic_iarchive::operator&(t);
- }
-
- // all current archives take a stream as constructor argument
- template <class _Elem, class _Tr>
- polymorphic_iarchive_dispatch(
- std::basic_istream<_Elem, _Tr> & is,
- unsigned int flags = 0
- ) :
- ArchiveImplementation(is, flags)
- {}
-};
-
-} // namespace detail
-} // namespace archive
-} // namespace boost
-
-#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-
-#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP
Deleted: trunk/boost/archive/detail/polymorphic_oarchive_dispatch.hpp
==============================================================================
--- trunk/boost/archive/detail/polymorphic_oarchive_dispatch.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
+++ (empty file)
@@ -1,185 +0,0 @@
-#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP
-#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_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
-// polymorphic_oarchive_dispatch.hpp
-
-// (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 <string>
-#include <ostream>
-#include <boost/noncopyable.hpp>
-#include <boost/cstdint.hpp>
-#include <cstddef> // size_t
-
-#include <boost/config.hpp>
-#if defined(BOOST_NO_STDC_NAMESPACE)
-namespace std{
- using ::size_t;
-} // namespace std
-#endif
-
-#include <boost/archive/polymorphic_oarchive.hpp>
-#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
-
-namespace boost {
-template<class T>
-class shared_ptr;
-namespace serialization {
- class extended_type_info;
-} // namespace serialization
-namespace archive {
-namespace detail{
-
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
-
-template<class ArchiveImplementation>
-class polymorphic_oarchive_dispatch :
- public polymorphic_oarchive,
- // note: gcc dynamic cross cast fails if the the derivation below is
- // not public. I think this is a mistake.
- public /*protected*/ ArchiveImplementation,
- private boost::noncopyable
-{
-private:
- // these are used by the serialization library.
- virtual void save_object(
- const void *x,
- const detail::basic_oserializer & bos
- ){
- ArchiveImplementation::save_object(x, bos);
- }
- virtual void save_pointer(
- const void * t,
- const detail::basic_pointer_oserializer * bpos_ptr
- ){
- ArchiveImplementation::save_pointer(t, bpos_ptr);
- }
- virtual void save_null_pointer(){
- ArchiveImplementation::save_null_pointer();
- }
- // primitive types the only ones permitted by polymorphic archives
- virtual void save(const bool t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const char t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const signed char t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const unsigned char t){
- ArchiveImplementation::save(t);
- }
- #ifndef BOOST_NO_CWCHAR
- #ifndef BOOST_NO_INTRINSIC_WCHAR_T
- virtual void save(const wchar_t t){
- ArchiveImplementation::save(t);
- }
- #endif
- #endif
- virtual void save(const short t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const unsigned short t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const int t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const unsigned int t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const long t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const unsigned long t){
- ArchiveImplementation::save(t);
- }
- #if !defined(BOOST_NO_INTRINSIC_INT64_T)
- virtual void save(const boost::int64_t t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const boost::uint64_t t){
- ArchiveImplementation::save(t);
- }
- #endif
- virtual void save(const float t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const double t){
- ArchiveImplementation::save(t);
- }
- virtual void save(const std::string & t){
- ArchiveImplementation::save(t);
- }
- #ifndef BOOST_NO_STD_WSTRING
- virtual void save(const std::wstring & t){
- ArchiveImplementation::save(t);
- }
- #endif
- virtual unsigned int get_library_version() const{
- return ArchiveImplementation::get_library_version();
- }
- virtual unsigned int get_flags() const {
- return ArchiveImplementation::get_flags();
- }
- virtual void save_binary(const void * t, std::size_t size){
- ArchiveImplementation::save_binary(t, size);
- }
- // used for xml and other tagged formats default does nothing
- virtual void save_start(const char * name){
- ArchiveImplementation::save_start(name);
- }
- virtual void save_end(const char * name){
- ArchiveImplementation::save_end(name);
- }
- virtual void end_preamble(){
- ArchiveImplementation::end_preamble();
- }
- virtual void register_basic_serializer(const detail::basic_oserializer & bos){
- ArchiveImplementation::register_basic_serializer(bos);
- }
-public:
- // this can't be inheriteded because they appear in mulitple
- // parents
- typedef mpl::bool_<false> is_loading;
- typedef mpl::bool_<true> is_saving;
- // the << operator
- template<class T>
- polymorphic_oarchive & operator<<(T & t){
- return polymorphic_oarchive::operator<<(t);
- }
- // the & operator
- template<class T>
- polymorphic_oarchive & operator&(T & t){
- return polymorphic_oarchive::operator&(t);
- }
- // all current archives take a stream as constructor argument
- template <class _Elem, class _Tr>
- polymorphic_oarchive_dispatch(
- std::basic_ostream<_Elem, _Tr> & os,
- unsigned int flags = 0
- ) :
- ArchiveImplementation(os, flags)
- {}
-};
-
-} // namespace detail
-} // namespace archive
-} // namespace boost
-
-#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-
-#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP
Modified: trunk/boost/archive/detail/register_archive.hpp
==============================================================================
--- trunk/boost/archive/detail/register_archive.hpp (original)
+++ trunk/boost/archive/detail/register_archive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -4,8 +4,6 @@
#ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
-# include <boost/type_traits/add_pointer.hpp>
-
namespace boost { namespace archive { namespace detail {
template <class Archive, class Serializable>
Modified: trunk/boost/archive/impl/archive_pointer_iserializer.ipp
==============================================================================
--- trunk/boost/archive/impl/archive_pointer_iserializer.ipp (original)
+++ trunk/boost/archive/impl/archive_pointer_iserializer.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -8,10 +8,12 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <utility>
#include <cassert>
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
+#include <boost/serialization/singleton.hpp>
#include <boost/archive/detail/basic_serializer_map.hpp>
#include <boost/archive/detail/archive_pointer_iserializer.hpp>
@@ -19,12 +21,11 @@
namespace archive {
namespace detail {
-template<class Archive>
-basic_serializer_map *
-iserializer_map(){
- static bool deleted = false;
- static basic_serializer_map map(deleted);
- return deleted ? NULL : & map;
+namespace { // anon
+ template<class Archive>
+ class serializer_map : public basic_serializer_map
+ {
+ };
}
template<class Archive>
@@ -34,9 +35,11 @@
) :
basic_pointer_iserializer(eti)
{
- basic_serializer_map *mp = iserializer_map<Archive>();
- assert(NULL != mp);
- mp->insert(this);
+ std::pair<BOOST_DEDUCED_TYPENAME serializer_map<Archive>::iterator, bool> result;
+ result = serialization::singleton<
+ serializer_map<Archive>
+ >::get_mutable_instance().insert(this);
+ assert(result.second);
}
template<class Archive>
@@ -44,9 +47,19 @@
archive_pointer_iserializer<Archive>::find(
const boost::serialization::extended_type_info & eti
){
- basic_serializer_map *mp = iserializer_map<Archive>();
- assert(NULL != mp);
- return static_cast<const basic_pointer_iserializer *>(mp->tfind(eti));
+ const basic_serializer_arg bs(eti);
+ BOOST_DEDUCED_TYPENAME serializer_map<Archive>::const_iterator it;
+ it = boost::serialization::singleton<
+ serializer_map<Archive>
+ >::get_const_instance().find(& bs);
+ assert(
+ it
+ !=
+ boost::serialization::singleton<
+ serializer_map<Archive>
+ >::get_const_instance().end()
+ );
+ return static_cast<const basic_pointer_iserializer *>(*it);
}
template<class Archive>
@@ -54,10 +67,11 @@
archive_pointer_iserializer<Archive>::~archive_pointer_iserializer(){
// 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 = iserializer_map<Archive>();
- if(NULL == mp)
- return;
- mp->erase(this);
+ unsigned int count;
+ count = serialization::singleton<
+ serializer_map<Archive>
+ >::get_mutable_instance().erase(this);
+ assert(count);
}
} // namespace detail
Modified: trunk/boost/archive/impl/archive_pointer_oserializer.ipp
==============================================================================
--- trunk/boost/archive/impl/archive_pointer_oserializer.ipp (original)
+++ trunk/boost/archive/impl/archive_pointer_oserializer.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -8,6 +8,9 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <utility>
+#include <cassert>
+
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#include <boost/archive/detail/archive_pointer_oserializer.hpp>
@@ -17,12 +20,11 @@
namespace archive {
namespace detail {
-template<class Archive>
-basic_serializer_map *
-oserializer_map(){
- static bool deleted = false;
- static basic_serializer_map map(deleted);
- return deleted ? NULL : & map;
+namespace { // anon
+ template<class Archive>
+ class serializer_map : public basic_serializer_map
+ {
+ };
}
template<class Archive>
@@ -32,9 +34,14 @@
) :
basic_pointer_oserializer(eti)
{
- basic_serializer_map *mp = oserializer_map<Archive>();
- assert(NULL != mp);
- mp->insert(this);
+ std::pair<
+ BOOST_DEDUCED_TYPENAME serializer_map<Archive>::iterator,
+ bool
+ > result;
+ result = serialization::singleton<
+ serializer_map<Archive>
+ >::get_mutable_instance().insert(this);
+ assert(result.second);
}
template<class Archive>
@@ -42,9 +49,19 @@
archive_pointer_oserializer<Archive>::find(
const boost::serialization::extended_type_info & eti
){
- basic_serializer_map *mp = oserializer_map<Archive>();
- assert(NULL != mp);
- return static_cast<const basic_pointer_oserializer *>(mp->tfind(eti));
+ const basic_serializer_arg bs(eti);
+ basic_serializer_map::const_iterator it;
+ it = boost::serialization::singleton<
+ serializer_map<Archive>
+ >::get_const_instance().find(& bs);
+ assert(
+ it
+ !=
+ boost::serialization::singleton<
+ serializer_map<Archive>
+ >::get_const_instance().end()
+ );
+ return static_cast<const basic_pointer_oserializer *>(*it);
}
template<class Archive>
@@ -52,10 +69,11 @@
archive_pointer_oserializer<Archive>::~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<Archive>();
- if(NULL == mp)
- return;
- mp->erase(this);
+ unsigned int count;
+ count = serialization::singleton<
+ serializer_map<Archive>
+ >::get_mutable_instance().erase(this);
+ assert(count);
}
} // namespace detail
Modified: trunk/boost/archive/impl/basic_binary_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_iarchive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -22,7 +22,6 @@
#include <boost/detail/workaround.hpp>
#include <boost/archive/basic_binary_iarchive.hpp>
-//#include <boost/serialization/extended_type_info.hpp>
namespace boost {
namespace archive {
Modified: trunk/boost/archive/impl/basic_binary_iprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_iprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_iprimitive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -96,7 +96,7 @@
s.resize(l);
// note breaking a rule here - could be a problem on some platform
if(0 < l)
- load_binary(&(*s.begin()), l);
+ load_binary(&(*s.begin()), l);
}
#ifndef BOOST_NO_CWCHAR
@@ -134,6 +134,7 @@
std::basic_streambuf<Elem, Tr> & sb,
bool no_codecvt
) :
+#ifndef BOOST_NO_STD_LOCALE
m_sb(sb),
archive_locale(NULL),
locale_saver(m_sb)
@@ -148,6 +149,10 @@
m_sb.pubimbue(* archive_locale);
}
}
+#else
+ m_sb(sb)
+{}
+#endif
// some libraries including stl and libcomo fail if the
// buffer isn't flushed before the code_cvt facet is changed.
Modified: trunk/boost/archive/impl/basic_binary_oprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_oprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_oprimitive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -103,6 +103,7 @@
std::basic_streambuf<Elem, Tr> & sb,
bool no_codecvt
) :
+#ifndef BOOST_NO_STD_LOCALE
m_sb(sb),
archive_locale(NULL),
locale_saver(m_sb)
@@ -117,6 +118,10 @@
m_sb.pubimbue(* archive_locale);
}
}
+#else
+ m_sb(sb)
+{}
+#endif
// some libraries including stl and libcomo fail if the
// buffer isn't flushed before the code_cvt facet is changed.
Modified: trunk/boost/archive/impl/basic_text_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iarchive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -22,7 +22,6 @@
#include <boost/detail/workaround.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
-//#include <boost/serialization/extended_type_info.hpp>
namespace boost {
namespace archive {
Modified: trunk/boost/archive/impl/basic_text_iprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iprimitive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -94,7 +94,8 @@
basic_text_iprimitive<IStream>::basic_text_iprimitive(
IStream &is_,
bool no_codecvt
-) :
+) :
+#ifndef BOOST_NO_STD_LOCALE
is(is_),
flags_saver(is_),
precision_saver(is_),
@@ -112,6 +113,12 @@
}
is >> std::noboolalpha;
}
+#else
+ is(is_),
+ flags_saver(is_),
+ precision_saver(is_)
+{}
+#endif
template<class IStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
Modified: trunk/boost/archive/impl/basic_text_oprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_oprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_oprimitive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -75,6 +75,7 @@
OStream & os_,
bool no_codecvt
) :
+#ifndef BOOST_NO_STD_LOCALE
os(os_),
flags_saver(os_),
precision_saver(os_),
@@ -92,6 +93,12 @@
}
os << std::noboolalpha;
}
+#else
+ os(os_),
+ flags_saver(os_),
+ precision_saver(os_)
+{}
+#endif
template<class OStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
Modified: trunk/boost/archive/impl/basic_xml_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_xml_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_xml_iarchive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -15,7 +15,6 @@
#include <boost/archive/basic_xml_iarchive.hpp>
#include <boost/serialization/tracking.hpp>
-//#include <boost/serialization/extended_type_info.hpp>
namespace boost {
namespace archive {
Modified: trunk/boost/archive/impl/basic_xml_oarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_xml_oarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_xml_oarchive.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,6 +18,7 @@
#include <boost/archive/basic_xml_archive.hpp>
#include <boost/archive/basic_xml_oarchive.hpp>
+#include <boost/archive/xml_archive_exception.hpp>
#include <boost/detail/no_exceptions_support.hpp>
namespace boost {
@@ -78,7 +79,7 @@
this->This()->put(' ');
this->This()->put(attribute_name);
this->This()->put("=\"");
- this->This()->put(key);
+ this->This()->save(key);
this->This()->put('"');
}
@@ -174,7 +175,9 @@
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const object_id_type & t, int)
{
- write_attribute(OBJECT_ID(), t, "=\"_");
+ // borland doesn't do conversion of STRONG_TYPEDEFs very well
+ const unsigned int i = t;
+ write_attribute(OBJECT_ID(), i, "=\"_");
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
@@ -182,13 +185,15 @@
const object_reference_type & t,
int
){
- write_attribute(OBJECT_REFERENCE(), t, "=\"_");
+ const unsigned int i = t;
+ write_attribute(OBJECT_REFERENCE(), i, "=\"_");
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const version_type & t, int)
{
- write_attribute(VERSION(), t);
+ const unsigned int i = t;
+ write_attribute(VERSION(), i);
}
template<class Archive>
Modified: trunk/boost/archive/impl/text_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/text_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/text_iarchive_impl.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -54,7 +54,7 @@
#endif
s.resize(size);
if(0 < size)
- is.read(&(*s.begin()), size);
+ is.read(&(*s.begin()), size);
}
#ifndef BOOST_NO_CWCHAR
Modified: trunk/boost/archive/impl/xml_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_iarchive_impl.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -32,7 +32,7 @@
#include <boost/detail/no_exceptions_support.hpp>
-#include <boost/archive/archive_exception.hpp>
+#include <boost/archive/xml_archive_exception.hpp>
#include <boost/archive/iterators/dataflow_exception.hpp>
#include <boost/archive/basic_xml_archive.hpp>
#include <boost/archive/xml_iarchive.hpp>
Modified: trunk/boost/archive/impl/xml_wiarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_wiarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_wiarchive_impl.ipp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -34,7 +34,7 @@
#include <boost/serialization/string.hpp>
#include <boost/archive/add_facet.hpp>
-#include <boost/archive/archive_exception.hpp>
+#include <boost/archive/xml_archive_exception.hpp>
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
#include <boost/archive/iterators/mb_from_wchar.hpp>
Modified: trunk/boost/archive/iterators/insert_linebreaks.hpp
==============================================================================
--- trunk/boost/archive/iterators/insert_linebreaks.hpp (original)
+++ trunk/boost/archive/iterators/insert_linebreaks.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -7,7 +7,7 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// binary_from_base64.hpp
+// insert_linebreaks.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
Modified: trunk/boost/archive/iterators/remove_whitespace.hpp
==============================================================================
--- trunk/boost/archive/iterators/remove_whitespace.hpp (original)
+++ trunk/boost/archive/iterators/remove_whitespace.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -7,7 +7,7 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// binary_from_base64.hpp
+// remove_whitespace.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
Modified: trunk/boost/archive/polymorphic_binary_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_binary_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_binary_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,17 +18,17 @@
#include <boost/config.hpp>
#include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
namespace boost {
namespace archive {
class polymorphic_binary_iarchive :
- public detail::polymorphic_iarchive_dispatch<naked_binary_iarchive>
+ public detail::polymorphic_iarchive_route<naked_binary_iarchive>
{
public:
polymorphic_binary_iarchive(std::istream & is, unsigned int flags = 0) :
- detail::polymorphic_iarchive_dispatch<naked_binary_iarchive>(is, flags)
+ detail::polymorphic_iarchive_route<naked_binary_iarchive>(is, flags)
{}
~polymorphic_binary_iarchive(){}
};
Modified: trunk/boost/archive/polymorphic_binary_oarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_binary_oarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_binary_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,12 +18,12 @@
#include <boost/config.hpp>
#include <boost/archive/binary_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
binary_oarchive_impl<
naked_binary_oarchive,
std::ostream::char_type,
Modified: trunk/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -123,7 +123,7 @@
load_end(t.name());
}
protected:
- virtual ~polymorphic_iarchive_impl(){}
+ virtual ~polymorphic_iarchive_impl(){};
public:
// utility function implemented by all legal archives
virtual void set_library_version(unsigned int archive_library_version) = 0;
@@ -166,7 +166,10 @@
class polymorphic_iarchive :
public polymorphic_iarchive_impl,
public detail::shared_ptr_helper
-{};
+{
+public:
+ virtual ~polymorphic_iarchive(){};
+};
} // namespace archive
} // namespace boost
Modified: trunk/boost/archive/polymorphic_oarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_oarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -123,7 +123,7 @@
save_end(t.name());
}
protected:
- virtual ~polymorphic_oarchive_impl(){}
+ virtual ~polymorphic_oarchive_impl(){};
public:
// utility functions implemented by all legal archives
virtual unsigned int get_flags() const = 0;
@@ -143,7 +143,10 @@
// note: preserve naming symmetry
class polymorphic_oarchive :
public polymorphic_oarchive_impl
-{};
+{
+public:
+ virtual ~polymorphic_oarchive(){};
+};
} // namespace archive
} // namespace boost
Modified: trunk/boost/archive/polymorphic_text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_text_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_text_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,17 +18,17 @@
#include <boost/config.hpp>
#include <boost/archive/text_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
namespace boost {
namespace archive {
class polymorphic_text_iarchive :
- public detail::polymorphic_iarchive_dispatch<naked_text_iarchive>
+ public detail::polymorphic_iarchive_route<naked_text_iarchive>
{
public:
polymorphic_text_iarchive(std::istream & is, unsigned int flags = 0) :
- detail::polymorphic_iarchive_dispatch<naked_text_iarchive>(is, flags)
+ detail::polymorphic_iarchive_route<naked_text_iarchive>(is, flags)
{}
~polymorphic_text_iarchive(){}
};
Modified: trunk/boost/archive/polymorphic_text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_text_oarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_text_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,12 +18,12 @@
#include <boost/config.hpp>
#include <boost/archive/text_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
text_oarchive_impl<naked_text_oarchive>
> polymorphic_text_oarchive;
Modified: trunk/boost/archive/polymorphic_text_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_text_wiarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_text_wiarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -22,12 +22,12 @@
#else
#include <boost/archive/text_wiarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_dispatch<
+typedef detail::polymorphic_iarchive_route<
text_wiarchive_impl<naked_text_wiarchive>
> polymorphic_text_wiarchive;
Modified: trunk/boost/archive/polymorphic_text_woarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_text_woarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_text_woarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -22,12 +22,12 @@
#else
#include <boost/archive/text_woarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
text_woarchive_impl<naked_text_woarchive>
> polymorphic_text_woarchive;
Modified: trunk/boost/archive/polymorphic_xml_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_xml_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_xml_iarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,17 +18,17 @@
#include <boost/config.hpp>
#include <boost/archive/xml_iarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
namespace boost {
namespace archive {
class polymorphic_xml_iarchive :
- public detail::polymorphic_iarchive_dispatch<naked_xml_iarchive>
+ public detail::polymorphic_iarchive_route<naked_xml_iarchive>
{
public:
polymorphic_xml_iarchive(std::istream & is, unsigned int flags = 0) :
- detail::polymorphic_iarchive_dispatch<naked_xml_iarchive>(is, flags)
+ detail::polymorphic_iarchive_route<naked_xml_iarchive>(is, flags)
{}
~polymorphic_xml_iarchive(){}
};
Modified: trunk/boost/archive/polymorphic_xml_oarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_xml_oarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_xml_oarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -18,12 +18,12 @@
#include <boost/config.hpp>
#include <boost/archive/xml_oarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
xml_oarchive_impl<naked_xml_oarchive>
> polymorphic_xml_oarchive;
Modified: trunk/boost/archive/polymorphic_xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_xml_wiarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_xml_wiarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -22,12 +22,12 @@
#else
#include <boost/archive/xml_wiarchive.hpp>
-#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_iarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_iarchive_dispatch<
+typedef detail::polymorphic_iarchive_route<
xml_wiarchive_impl<naked_xml_wiarchive>
> polymorphic_xml_wiarchive;
Modified: trunk/boost/archive/polymorphic_xml_woarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_xml_woarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_xml_woarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -22,12 +22,12 @@
#else
#include <boost/archive/xml_woarchive.hpp>
-#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp>
+#include <boost/archive/detail/polymorphic_oarchive_route.hpp>
namespace boost {
namespace archive {
-typedef detail::polymorphic_oarchive_dispatch<
+typedef detail::polymorphic_oarchive_route<
xml_woarchive_impl<naked_xml_woarchive>
> polymorphic_xml_woarchive;
Modified: trunk/boost/archive/shared_ptr_helper.hpp
==============================================================================
--- trunk/boost/archive/shared_ptr_helper.hpp (original)
+++ trunk/boost/archive/shared_ptr_helper.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -7,7 +7,7 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// shared_ptr.hpp: serialization for boost shared pointer
+// shared_ptr_helper.hpp: serialization for boost shared pointer
// (C) Copyright 2004 Robert Ramey and Martin Ecker
// Use, modification and distribution is subject to the Boost Software
@@ -21,6 +21,7 @@
#include <boost/config.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/shared_ptr_132.hpp>
#include <boost/throw_exception.hpp>
@@ -87,7 +88,7 @@
void * object_identifier(T * t) const {
const boost::serialization::extended_type_info * true_type
= boost::serialization::type_info_implementation<T>::type
- ::get_derived_extended_type_info(*t);
+ ::get_const_instance().get_derived_extended_type_info(*t);
// note:if this exception is thrown, be sure that derived pointer
// is either registered or exported.
if(NULL == true_type)
@@ -97,10 +98,12 @@
)
);
const boost::serialization::extended_type_info * this_type
- = boost::serialization::type_info_implementation<T>::type::get_instance();
+ = & boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance();
void * vp = void_downcast(*true_type, *this_type, t);
return vp;
}
+public:
template<class T>
void reset(shared_ptr<T> & s, T * r){
if(NULL == r){
Added: trunk/boost/archive/xml_archive_exception.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/archive/xml_archive_exception.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -0,0 +1,65 @@
+#ifndef BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP
+#define BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_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
+// xml_archive_exception.hpp:
+
+// (C) Copyright 2007 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 <exception>
+#include <cassert>
+
+#include <boost/archive/archive_exception.hpp>
+
+namespace boost {
+namespace archive {
+
+//////////////////////////////////////////////////////////////////////
+// exceptions thrown by xml archives
+//
+class xml_archive_exception :
+ public virtual archive_exception
+{
+public:
+ typedef enum {
+ xml_archive_parsing_error, // see save_register
+ xml_archive_tag_mismatch,
+ xml_archive_tag_name_error
+ } exception_code;
+ xml_archive_exception(exception_code c)
+ {}
+ virtual const char *what( ) const throw( )
+ {
+ const char *msg;
+ switch(code){
+ case xml_archive_parsing_error:
+ msg = "unrecognized XML syntax";
+ break;
+ case xml_archive_tag_mismatch:
+ msg = "XML start/end tag mismatch";
+ break;
+ case xml_archive_tag_name_error:
+ msg = "Invalid XML tag name";
+ break;
+ default:
+ msg = archive_exception::what();
+ break;
+ }
+ return msg;
+ }
+};
+
+}// namespace archive
+}// namespace boost
+
+#endif //BOOST_XML_ARCHIVE_ARCHIVE_EXCEPTION_HPP
Modified: trunk/boost/archive/xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_wiarchive.hpp (original)
+++ trunk/boost/archive/xml_wiarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -88,7 +88,7 @@
};
// do not derive from the classes below. If you want to extend this functionality
-// via inhertance, derived from text_iarchive_impl instead. This will
+// via inhertance, derived from xml_wiarchive_impl instead. This will
// preserve correct static polymorphism.
// same as xml_wiarchive below - without the shared_ptr_helper
Modified: trunk/boost/archive/xml_woarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_woarchive.hpp (original)
+++ trunk/boost/archive/xml_woarchive.hpp 2008-03-18 01:53:07 EDT (Tue, 18 Mar 2008)
@@ -39,11 +39,13 @@
namespace boost {
namespace archive {
+#if 0
BOOST_WARCHIVE_DECL(std::wostream &)
operator<<(std::wostream &os, const char *t);
BOOST_WARCHIVE_DECL(std::wostream &)
operator<<(std::wostream &os, const char t);
+#endif
template<class Archive>
class xml_woarchive_impl :
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