|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55676 - in trunk/libs/serialization: doc src test vc7ide
From: ramey_at_[hidden]
Date: 2009-08-20 01:33:02
Author: ramey
Date: 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
New Revision: 55676
URL: http://svn.boost.org/trac/boost/changeset/55676
Log:
Fix error in export functionality:
a) set key when etf record is constructed.
b) make corrections in no_rtti type system
c) make no_rtti type system more robust and self-diagnosing
Text files modified:
trunk/libs/serialization/doc/extended_type_info.html | 81 +++++++++++++++++++++++----------------
trunk/libs/serialization/doc/traits.html | 38 +++++++++++++----
trunk/libs/serialization/src/extended_type_info.cpp | 30 +++++--------
trunk/libs/serialization/src/extended_type_info_no_rtti.cpp | 16 ++++---
trunk/libs/serialization/src/extended_type_info_typeid.cpp | 14 ++++--
trunk/libs/serialization/test/polymorphic_base.cpp | 2
trunk/libs/serialization/test/polymorphic_base.hpp | 5 ++
trunk/libs/serialization/test/polymorphic_derived1.cpp | 5 -
trunk/libs/serialization/test/polymorphic_derived1.hpp | 3 +
trunk/libs/serialization/test/polymorphic_derived2.cpp | 2
trunk/libs/serialization/test/polymorphic_derived2.hpp | 13 ++++-
trunk/libs/serialization/test/test_class_info_save.cpp | 2
trunk/libs/serialization/test/test_dll_exported.cpp | 5 -
trunk/libs/serialization/test/test_exported.cpp | 2
trunk/libs/serialization/test/test_no_rtti.cpp | 22 +++-------
trunk/libs/serialization/vc7ide/Library.vcproj | 3 +
trunk/libs/serialization/vc7ide/dll_a.vcproj | 34 +++++----------
trunk/libs/serialization/vc7ide/dll_base.vcproj | 22 ++-------
trunk/libs/serialization/vc7ide/dll_derived2.vcproj | 22 ++-------
trunk/libs/serialization/vc7ide/polymorphic_derived2.vcproj | 34 +++++----------
trunk/libs/serialization/vc7ide/test_array.vcproj | 3 -
trunk/libs/serialization/vc7ide/test_dll_exported.vcproj | 35 +++++-----------
trunk/libs/serialization/vc7ide/test_dll_plugin.vcproj | 6 --
trunk/libs/serialization/vc7ide/test_exported.vcproj | 3 +
24 files changed, 192 insertions(+), 210 deletions(-)
Modified: trunk/libs/serialization/doc/extended_type_info.html
==============================================================================
--- trunk/libs/serialization/doc/extended_type_info.html (original)
+++ trunk/libs/serialization/doc/extended_type_info.html 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -105,14 +105,15 @@
// this class can't be used as is. It's just the
// common functionality for all type_info replacement
// systems. Hence, make these protected
- const char * m_key;
- extended_type_info(const unsigned int type_info_key);
+ extended_type_info(
+ const unsigned int type_info_key,
+ const char * key
+ );
~extended_type_info();
+ void key_register();
+ void key_unregister();
public:
- void key_register(const char *key);
- const char * get_key() const {
- return m_key;
- }
+ const char * get_key() const;
bool operator<(const extended_type_info &rhs) const;
bool operator==(const extended_type_info &rhs) const;
bool operator!=(const extended_type_info &rhs) const {
@@ -139,30 +140,43 @@
<dl>
<dt><h4><pre><code>
-extended_type_info(unsigned int type_info_key);
+extended_type_info(unsigned int type_info_key, const char *key);
</code></pre></h4></dt>
<dd>
This constructor should be called by all derived classes.
-The argument should be the particular implementation. For
-this default implementation base on typeid(), this is the
+The first argument should be the particular implementation.
+For this default implementation base on typeid(), this is the
value 1. Each system must have its own integer. This value
is used to permit the inter-operability of different typeinfo
systems.
+<p>
+The second argument is a const string which is the external
+name of the type to which this record corresponds.
+It may sometimes be referred to as a GUID - a <b>G</b>lobal <b>U</b>nique <b>ID</b>entifier.
+It is passed through archives from one program invocation to
+another to uniquely identify the types that the archive contains.
+If the "export" facility is not going to be used,
+this value may be NULL.
</dd>
<dt><h4><pre><code>
-void key_register(const char *key);
+void key_register();
+void key_unregister();
</code></pre></h4></dt>
<dd>
-Assign a unique character string identifier to this
-<code style="white-space: normal"><a target="extended_type_info.hpp" href = "../../../boost/serialization/extended_type_info.hpp">extended_type_info</a></code>
-instance and add it to the corresponding global trable.
-This key is used to identify a type accross different instances of the program.
-In this way, one instance may know what type to create when necessary.
-For this purpose, it must be the same in all program instances which
-refer to the same type.
+This system maintains a global table which relates
+external strings to
+<code style="white-space: normal">extended_type_info</code> records.
+This table is used when loading pointers to objects serialized
+through a base class pointer. In this case, the archive
+contains a string which is looked up in this table to
+determine which <code style="white-space: normal">extended_type_info</code>
+to use for creating a new object.
<p>
-It may sometimes be referred to as a GUID - a <b>G</b>lobal <b>U</b>nique <b>ID</b>entifier.
+These functions are called by constructors and
+destructors of classes which implement
+<code style="white-space: normal">extended_type_info</code>
+to add and remove entries from this table.
</dd>
<dt><h4><pre><code>
@@ -185,7 +199,8 @@
extended_type_info
</code>
</a>
-objects. They a strict total ordering on all instances of this class.
+objects. They impose a strict total ordering on all
+<code style="white-space: normal">extended_type_info</code> records.
</dd>
<dt><h4><pre><code>
@@ -245,20 +260,6 @@
<dt><h4><code style="white-space: normal"><pre>
template<class ETI>
-static extended_type_info &
-ETI::get_mutable_instance();
-static const extended_type_info &
-ETI::get_const:instance();
-</pre></code></h4></dt>
-<dd>
-Return a pointer to the instance of
-<code style="white-space: normal">extended_type_info</code>
-which corresponds to type T. Normally these instances are static objects so
-this just amounts to returning the address of this static object.
-</dd>
-
-<dt><h4><code style="white-space: normal"><pre>
-template<class ETI>
const extended_type_info *
ETI::get_derived_extended_type_info(const T & t) const;
</pre></code></h4></dt>
@@ -274,11 +275,23 @@
</dd>
<dt><h4><code style="white-space: normal"><pre>
-bool ETI::less_than(const extended_type_info &rhs) const;
+virtual bool ETI::is_less_than(const extended_type_info &rhs) const;
+</pre></code></h4></dt>
+<dd>
+Compare this instance to another one using the same
+<code style="white-space: normal">extended_type_info</code> implementation.
+</dd>
+</dl>
+
+<dt><h4><code style="white-space: normal"><pre>
+virtual bool ETI::is_equal(const extended_type_info &rhs) const;
</pre></code></h4></dt>
<dd>
Compare this instance to another one using the same
<code style="white-space: normal">extended_type_info</code> implementation.
+Return <code style="white-space: normal">true</code> if the types referred
+to are the same. Otherwise return
+<code style="white-space: normal">false</code>
</dd>
</dl>
Modified: trunk/libs/serialization/doc/traits.html
==============================================================================
--- trunk/libs/serialization/doc/traits.html (original)
+++ trunk/libs/serialization/doc/traits.html 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -1,4 +1,4 @@
-<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
(C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
@@ -176,7 +176,7 @@
<ul>
<li>For primitive, <code style="white-space: normal">track_never</code>.
<li>For pointers, <code style="white-space: normal">track_never</code>.
- That is, addresses of addresses are not tracked by default.
+ That i', addresses of addresses are not tracked by default.
<li>All current serialization wrappers such as <code style="white-space: normal">boost::serialization::nvp</code>,
<code style="white-space: normal">track_never</code>.
<li>For all other types, <code style="white-space: normal">track_selectively</code>.
@@ -206,7 +206,7 @@
When serializing a derived class through a base class pointer, it
may be convenient to define an external name by which the
derived class can be identified.
-<i>(<a target="detail" href="special.html#derivedpointers">Elsewhere</a>
+<i>(<a target="detail" href="special.html#export">Elsewhere</a>
in this manual, the
serialization of derived classes is addressed in detail.)</i>
Standard C++ does implement <code style="white-space: normal">typeid()</code> which can be
@@ -240,8 +240,28 @@
<pre><code>
BOOST_CLASS_EXPORT_GUID(my_class, "my_class")
</code></pre>
-If the an external name is required somewhere in the program and none
-has been assigned, a static assertion will be invoked.
+Failure to export a type which requires it will result in an
+exception being thrown at runtime.
+<p>
+This above macros
+<ul>
+<li> Add and access entries into two static global tables.
+ <ul>
+ <li> key->type
+ <li> type->key
+ </ul>
+<li> Explicitly instantiate code to serialize pointers to types
+never serialized by name.
+</ul>
+These declarations can be placed in either header or implementation
+files. However, in some cases, namely the creation of DLLS, placment
+in header files will result code being generated in both
+the mainline and DLL. This shouldn't create a problem, but
+it will result in the duplication of code. It would also be
+possible that the code in the DLL might evolve so that the
+implemenations are not longer compatible. So, placing
+these macros in a header used by DLLS and the mainline
+would seem to defeat the purpose of using a DLL in the first place.
<h3><a name="abstract">Abstract</a></h3>
When serializing an object through a pointer to its base class,
@@ -257,7 +277,7 @@
will return the correct value for all compilers.
<h3><a name="typeinfo">Type Information Implementation</a></h3>
-This last trait is also related to the serialization of objects
+This last trait is also related to the serialization of ob'ects
through a base class pointer. The implementation of this facility
requires the ability to determine at run time the true type of the
object that a base class pointer points to. Different serialization
@@ -353,10 +373,8 @@
</code></pre>
which expands to the code above.
-
-
<h3><a name="templates">Template Serialization Traits</a></h3>
-In some instances it might be convenient to assign serialization traits
+In 'ome instances it might be convenient to assign serialization traits
to a whole group of classes at once. Consider, the name-value pair
wrapper
<pre><code>
@@ -460,7 +478,7 @@
<p>
<table border>
<tr><th align=left>parameter</th><th align=left>description</th><th align=left>permitted values</th><th align=left>default value</th></tr>
-<tr><td><code>T</code></td><td>target class</td><td>class name<T></td><td>none</td></tr>
+<tr><td><code>T</code></td><td>target class<'td><td>class name<T></td><td>none</td></tr>
<tr><td><code>Level</code></td><td>implementation level</td><td><code>not_serializable<br>primitive_type<br>object_serializable<br>object_class_info</code></td><td>none</td></tr>
<tr><td><code>Tracking</code></td><td>tracking level</td><td><code>track_never<br>track_selectivly<br>track_always</code></td><td>none</td></tr>
<tr><td><code>Version</code></td><td><code>class version</td><td>unsigned integer</td><td><code>0</code></td></tr>
Modified: trunk/libs/serialization/src/extended_type_info.cpp
==============================================================================
--- trunk/libs/serialization/src/extended_type_info.cpp (original)
+++ trunk/libs/serialization/src/extended_type_info.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -77,38 +77,34 @@
};
public:
extended_type_info_arg(const char * key) :
- extended_type_info()
- {
- m_key = key;
- }
+ extended_type_info(0, key)
+ {}
+
~extended_type_info_arg(){
- m_key = NULL;
}
};
} // namespace detail
BOOST_SERIALIZATION_DECL(void)
-extended_type_info::key_register(const char *key) {
- assert(NULL != key);
- m_key = key;
+extended_type_info::key_register() const{
+ if(NULL == get_key())
+ return;
singleton<detail::ktmap>::get_mutable_instance().insert(this);
}
BOOST_SERIALIZATION_DECL(void)
-extended_type_info::key_unregister() {
- assert(NULL != m_key);
+extended_type_info::key_unregister() const{
+ if(NULL == get_key())
+ return;
if(! singleton<detail::ktmap>::is_destroyed()){
detail::ktmap & x = singleton<detail::ktmap>::get_mutable_instance();
detail::ktmap::iterator start = x.lower_bound(this);
detail::ktmap::iterator end = x.upper_bound(this);
- assert(start != end);
-
// remove entry in map which corresponds to this type
for(;start != end; ++start){
if(this == *start){
x.erase(start);
- m_key = NULL;
break;
}
}
@@ -135,19 +131,17 @@
BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
extended_type_info::extended_type_info(
- const unsigned int type_info_key
+ const unsigned int type_info_key,
+ const char * key
) :
m_this(this, null_deleter()),
m_type_info_key(type_info_key),
- m_key(NULL)
+ m_key(key)
{
}
BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
extended_type_info::~extended_type_info(){
- if(NULL == m_key)
- return;
- key_unregister();
}
BOOST_SERIALIZATION_DECL(bool)
Modified: trunk/libs/serialization/src/extended_type_info_no_rtti.cpp
==============================================================================
--- trunk/libs/serialization/src/extended_type_info_no_rtti.cpp (original)
+++ trunk/libs/serialization/src/extended_type_info_no_rtti.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -25,11 +25,13 @@
namespace boost {
namespace serialization {
-namespace detail {
+namespace no_rtti_system {
BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
-extended_type_info_no_rtti_0::extended_type_info_no_rtti_0() :
- extended_type_info(EXTENDED_TYPE_INFO_NO_RTTI_KEY)
+extended_type_info_no_rtti_0::extended_type_info_no_rtti_0(
+ const char * key
+) :
+ extended_type_info(EXTENDED_TYPE_INFO_NO_RTTI_KEY, key)
{}
BOOST_SERIALIZATION_DECL(bool)
@@ -39,7 +41,7 @@
// shortcut for common case
if(this == & rhs)
return false;
- const char * l = m_key;
+ const char * l = get_key();
const char * r = rhs.get_key();
// if this assertion is triggered, it could mean one of the following
// a) This class was never exported - make sure all calls which use
@@ -63,14 +65,14 @@
if(this == & rhs)
return true;
// null keys don't match with anything
- const char * l = m_key;
- //assert(NULL != l);
+ const char * l = get_key();
+ assert(NULL != l);
if(NULL == l)
return false;
const char * r = rhs.get_key();
+ assert(NULL != r);
if(NULL == r)
return false;
- assert(NULL != r);
return 0 == std::strcmp(l, r);
}
Modified: trunk/libs/serialization/src/extended_type_info_typeid.cpp
==============================================================================
--- trunk/libs/serialization/src/extended_type_info_typeid.cpp (original)
+++ trunk/libs/serialization/src/extended_type_info_typeid.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -24,7 +24,7 @@
namespace boost {
namespace serialization {
-namespace detail {
+namespace typeid_system {
#define EXTENDED_TYPE_INFO_TYPE_KEY 1
@@ -70,8 +70,10 @@
}
BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
-extended_type_info_typeid_0::extended_type_info_typeid_0() :
- extended_type_info(EXTENDED_TYPE_INFO_TYPE_KEY),
+extended_type_info_typeid_0::extended_type_info_typeid_0(
+ const char * key
+) :
+ extended_type_info(EXTENDED_TYPE_INFO_TYPE_KEY, key),
m_ti(NULL)
{}
@@ -112,7 +114,9 @@
public extended_type_info_typeid_0
{
public:
- extended_type_info_typeid_arg(const std::type_info & ti){
+ extended_type_info_typeid_arg(const std::type_info & ti) :
+ extended_type_info_typeid_0(NULL)
+ {
// note absense of self register and key as this is used only as
// search argument given a type_info reference and is not to
// be added to the map.
@@ -127,7 +131,7 @@
extended_type_info_typeid_0::get_extended_type_info(
const std::type_info & ti
) const {
- detail::extended_type_info_typeid_arg etia(ti);
+ typeid_system::extended_type_info_typeid_arg etia(ti);
const tkmap & t = singleton<tkmap>::get_const_instance();
const tkmap::const_iterator it = t.find(& etia);
if(t.end() == it)
Modified: trunk/libs/serialization/test/polymorphic_base.cpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_base.cpp (original)
+++ trunk/libs/serialization/test/polymorphic_base.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -11,7 +11,7 @@
#include <boost/serialization/export.hpp>
#include "polymorphic_base.hpp"
-BOOST_CLASS_EXPORT(polymorphic_base)
+BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_base)
const char * polymorphic_base::get_key() const{
return
Modified: trunk/libs/serialization/test/polymorphic_base.hpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_base.hpp (original)
+++ trunk/libs/serialization/test/polymorphic_base.hpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -17,6 +17,8 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/serialization/access.hpp>
+#include <boost/serialization/assume_abstract.hpp>
+#include <boost/serialization/export.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
@@ -38,6 +40,9 @@
BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
+// the no_rtti system requires this !!!
+BOOST_CLASS_EXPORT_KEY(polymorphic_base)
+
BOOST_CLASS_TYPE_INFO(
polymorphic_base,
boost::serialization::extended_type_info_no_rtti<polymorphic_base>
Modified: trunk/libs/serialization/test/polymorphic_derived1.cpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_derived1.cpp (original)
+++ trunk/libs/serialization/test/polymorphic_derived1.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -9,16 +9,15 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/serialization/type_info_implementation.hpp>
-#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/export.hpp>
#include "polymorphic_derived1.hpp"
const char * polymorphic_derived1::get_key() const {
- return
+ return
boost::serialization::type_info_implementation<
polymorphic_derived1
>::type::get_const_instance().get_key();
}
-BOOST_CLASS_EXPORT(polymorphic_derived1)
+BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived1)
Modified: trunk/libs/serialization/test/polymorphic_derived1.hpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_derived1.hpp (original)
+++ trunk/libs/serialization/test/polymorphic_derived1.hpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -23,6 +23,7 @@
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include "polymorphic_base.hpp"
+
class polymorphic_derived1 : public polymorphic_base
{
friend class boost::serialization::access;
@@ -34,6 +35,8 @@
virtual const char * get_key() const ;
};
+BOOST_CLASS_EXPORT_KEY(polymorphic_derived1)
+
BOOST_CLASS_TYPE_INFO(
polymorphic_derived1,
extended_type_info_no_rtti<polymorphic_derived1>
Modified: trunk/libs/serialization/test/polymorphic_derived2.cpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_derived2.cpp (original)
+++ trunk/libs/serialization/test/polymorphic_derived2.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -45,7 +45,7 @@
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)
// note: export has to be AFTER #includes for all archive classes
-BOOST_CLASS_EXPORT(polymorphic_derived2)
+BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
// export plug-in not yet working !!!
#if 0
Modified: trunk/libs/serialization/test/polymorphic_derived2.hpp
==============================================================================
--- trunk/libs/serialization/test/polymorphic_derived2.hpp (original)
+++ trunk/libs/serialization/test/polymorphic_derived2.hpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -1,5 +1,5 @@
-#ifndef DERIVED2_HPP
-#define DERIVED2_HPP
+#ifndef POLYMORPHIC_DERIVED2_HPP
+#define POLYMORPHIC_DERIVED2_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -51,6 +51,13 @@
}
};
+// we use this because we want to assign a key to this type
+// but we don't want to explicitly instantiate code every time
+// we do so!!!. If we don't do this, we end up with the same
+// code in BOTH the DLL which implements polymorphic_derived2
+// as well as the main program.
+BOOST_CLASS_EXPORT_KEY(polymorphic_derived2)
+
// note the mixing of type_info systems is supported.
BOOST_CLASS_TYPE_INFO(
polymorphic_derived2,
@@ -59,5 +66,5 @@
#undef DLL_DECL
-#endif // DERIVED2_HPP
+#endif // POLYMORPHIC_DERIVED2_HPP
Modified: trunk/libs/serialization/test/test_class_info_save.cpp
==============================================================================
--- trunk/libs/serialization/test/test_class_info_save.cpp (original)
+++ trunk/libs/serialization/test/test_class_info_save.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -42,6 +42,7 @@
BOOST_CLASS_TRACKING(A, ::boost::serialization::track_never)
// second case : serialize WITH class information
+// note: GCC compile fails if this is after the class declaration
class B;
BOOST_CLASS_VERSION(B, 2)
@@ -79,7 +80,6 @@
std::cout << "b.count=" << b.count << '\n' ;
}
-
int
test_main( int /* argc */, char* /* argv */[] )
{
Modified: trunk/libs/serialization/test/test_dll_exported.cpp
==============================================================================
--- trunk/libs/serialization/test/test_dll_exported.cpp (original)
+++ trunk/libs/serialization/test/test_dll_exported.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -43,7 +43,6 @@
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
-#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/access.hpp>
#include "polymorphic_base.hpp"
@@ -62,11 +61,11 @@
virtual ~polymorphic_derived1(){}
};
+BOOST_CLASS_EXPORT(polymorphic_derived1)
+
// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1)
-BOOST_CLASS_EXPORT(polymorphic_derived1)
-
#define POLYMORPHIC_DERIVED2_IMPORT
#include "polymorphic_derived2.hpp"
Modified: trunk/libs/serialization/test/test_exported.cpp
==============================================================================
--- trunk/libs/serialization/test/test_exported.cpp (original)
+++ trunk/libs/serialization/test/test_exported.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -50,7 +50,7 @@
#include "polymorphic_derived2.hpp"
-BOOST_CLASS_EXPORT(polymorphic_derived2)
+BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)
Modified: trunk/libs/serialization/test/test_no_rtti.cpp
==============================================================================
--- trunk/libs/serialization/test/test_no_rtti.cpp (original)
+++ trunk/libs/serialization/test/test_no_rtti.cpp 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -30,20 +30,19 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/archive/archive_exception.hpp>
-#include "test_tools.hpp"
-#include <boost/preprocessor/stringize.hpp>
-#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/nvp.hpp>
+#include "test_tools.hpp"
+#include <boost/preprocessor/stringize.hpp>
+#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
+
#include "polymorphic_base.hpp"
#include "polymorphic_derived1.hpp"
-
#include "polymorphic_derived2.hpp"
-BOOST_CLASS_EXPORT(polymorphic_derived2)
template void polymorphic_derived2::serialize(
test_oarchive & ar,
@@ -65,24 +64,21 @@
std::cout << "saving polymorphic_derived1 (no_rtti)\n";
oa << BOOST_SERIALIZATION_NVP(rd1);
+
std::cout << "saving polymorphic_derived2\n";
oa << BOOST_SERIALIZATION_NVP(rd2);
- // the above opereration registers the derived classes as a side
- // effect. Hence, instances can now be correctly serialized through
- // a base class pointer.
- polymorphic_base *rb1 = rd1;
+ const polymorphic_base *rb1 = rd1;
polymorphic_base *rb2 = rd2;
std::cout << "saving polymorphic_derived1 (no_rtti) through base (no_rtti)\n";
oa << BOOST_SERIALIZATION_NVP(rb1);
- std::cout << "saving polymorphic_derived2 through base (no_rtti)\n";
+ std::cout << "saving polymorphic_derived2 through base\n";
oa << BOOST_SERIALIZATION_NVP(rb2);
delete rd1;
delete rd2;
}
-// save derived polymorphic class
void load_derived(const char *testfile)
{
test_istream is(testfile, TEST_STREAM_FLAGS);
@@ -93,7 +89,6 @@
std::cout << "loading polymorphic_derived1 (no_rtti)\n";
ia >> BOOST_SERIALIZATION_NVP(rd1);
-
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<
polymorphic_derived1
@@ -144,7 +139,6 @@
,
"restored pointer b1 not of correct type"
);
-
std::cout << "loading polymorphic_derived2 through base (no_rtti)\n";
ia >> BOOST_SERIALIZATION_NVP(rb2);
@@ -152,7 +146,6 @@
rb2 == dynamic_cast<polymorphic_base *>(rd2),
"serialized pointers not correctly restored"
);
-
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<
polymorphic_derived2
@@ -164,7 +157,6 @@
,
"restored pointer b2 not of correct type"
);
-
delete rb1;
delete rb2;
}
Modified: trunk/libs/serialization/vc7ide/Library.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/Library.vcproj (original)
+++ trunk/libs/serialization/vc7ide/Library.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -679,6 +679,9 @@
RelativePath="..\..\..\boost\serialization\force_include.hpp">
</File>
<File
+ RelativePath="..\..\..\boost\serialization\non_convertible.hpp">
+ </File>
+ <File
RelativePath="..\..\..\boost\serialization\pfto.hpp">
</File>
<File
Modified: trunk/libs/serialization/vc7ide/dll_a.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/dll_a.vcproj (original)
+++ trunk/libs/serialization/vc7ide/dll_a.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -255,28 +255,18 @@
<References>
</References>
<Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\test\dll_a.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath="..\test\A.hpp">
- </File>
- <File
- RelativePath="..\test\A.ipp">
- </File>
- <File
- RelativePath="..\test\test_decl.hpp">
- </File>
- </Filter>
+ <File
+ RelativePath="..\test\A.hpp">
+ </File>
+ <File
+ RelativePath="..\test\A.ipp">
+ </File>
+ <File
+ RelativePath="..\test\dll_a.cpp">
+ </File>
+ <File
+ RelativePath="..\test\test_decl.hpp">
+ </File>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/serialization/vc7ide/dll_base.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/dll_base.vcproj (original)
+++ trunk/libs/serialization/vc7ide/dll_base.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -246,22 +246,12 @@
<References>
</References>
<Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\test\dll_base.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath="..\test\base.hpp">
- </File>
- </Filter>
+ <File
+ RelativePath="..\test\base.hpp">
+ </File>
+ <File
+ RelativePath="..\test\dll_base.cpp">
+ </File>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/serialization/vc7ide/dll_derived2.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/dll_derived2.vcproj (original)
+++ trunk/libs/serialization/vc7ide/dll_derived2.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -206,22 +206,12 @@
<References>
</References>
<Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\test\dll_derived2.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath="..\test\derived2.hpp">
- </File>
- </Filter>
+ <File
+ RelativePath="..\test\derived2.hpp">
+ </File>
+ <File
+ RelativePath="..\test\dll_derived2.cpp">
+ </File>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/serialization/vc7ide/polymorphic_derived2.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/polymorphic_derived2.vcproj (original)
+++ trunk/libs/serialization/vc7ide/polymorphic_derived2.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -204,28 +204,18 @@
<References>
</References>
<Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\test\polymorphic_base.cpp">
- </File>
- <File
- RelativePath="..\test\polymorphic_derived2.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath="..\test\polymorphic_base.hpp">
- </File>
- <File
- RelativePath="..\test\polymorphic_derived2.hpp">
- </File>
- </Filter>
+ <File
+ RelativePath="..\test\polymorphic_base.cpp">
+ </File>
+ <File
+ RelativePath="..\test\polymorphic_base.hpp">
+ </File>
+ <File
+ RelativePath="..\test\polymorphic_derived2.cpp">
+ </File>
+ <File
+ RelativePath="..\test\polymorphic_derived2.hpp">
+ </File>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/serialization/vc7ide/test_array.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_array.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_array.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -1756,9 +1756,6 @@
RelativePath="..\test\A.hpp">
</File>
<File
- RelativePath="..\test\A.ipp">
- </File>
- <File
RelativePath="..\test\test_array.cpp">
<FileConfiguration
Name="Debug runtime-dynamic threading-multi|Win32">
Modified: trunk/libs/serialization/vc7ide/test_dll_exported.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_dll_exported.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_dll_exported.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -130,29 +130,18 @@
Name="Library"/>
</References>
<Files>
- <Filter
- Name="Headers"
- Filter="">
- <File
- RelativePath="..\test\polymorphic_base.hpp">
- </File>
- <File
- RelativePath="..\test\polymorphic_derived1.hpp">
- </File>
- <File
- RelativePath="..\test\polymorphic_derived2.hpp">
- </File>
- </Filter>
- <Filter
- Name="Source"
- Filter="">
- <File
- RelativePath="..\test\polymorphic_base.cpp">
- </File>
- <File
- RelativePath="..\test\test_dll_exported.cpp">
- </File>
- </Filter>
+ <File
+ RelativePath="..\test\polymorphic_base.cpp">
+ </File>
+ <File
+ RelativePath="..\test\polymorphic_base.hpp">
+ </File>
+ <File
+ RelativePath="..\test\polymorphic_derived2.hpp">
+ </File>
+ <File
+ RelativePath="..\test\test_dll_exported.cpp">
+ </File>
</Files>
<Globals>
</Globals>
Modified: trunk/libs/serialization/vc7ide/test_dll_plugin.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_dll_plugin.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_dll_plugin.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -127,12 +127,6 @@
</References>
<Files>
<File
- RelativePath="..\test\base.hpp">
- </File>
- <File
- RelativePath="..\test\derived2.hpp">
- </File>
- <File
RelativePath="..\test\polymorphic_base.hpp">
</File>
<File
Modified: trunk/libs/serialization/vc7ide/test_exported.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_exported.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_exported.vcproj 2009-08-20 01:32:59 EDT (Thu, 20 Aug 2009)
@@ -130,6 +130,9 @@
RelativePath="..\test\polymorphic_base.cpp">
</File>
<File
+ RelativePath="..\test\polymorphic_base.hpp">
+ </File>
+ <File
RelativePath="..\test\test_exported.cpp">
</File>
</Files>
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