|
Boost-Commit : |
From: ramey_at_[hidden]
Date: 2007-11-22 01:10:27
Author: ramey
Date: 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
New Revision: 41295
URL: http://svn.boost.org/trac/boost/changeset/41295
Log:
tested with statically loaded dlls
Added:
branches/serialization_next_release/boost/libs/serialization/test/A.cpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/A.ipp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/base.hpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/derived2.hpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/dll_a.cpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/dll_base.cpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/dll_derived2.cpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/test_decl.hpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/test_dll_exported.cpp (contents, props changed)
branches/serialization_next_release/boost/libs/serialization/test/test_dll_simple.cpp (contents, props changed)
Text files modified:
branches/serialization_next_release/boost/libs/serialization/test/A.hpp | 301 ++++++++-------------------------------
branches/serialization_next_release/boost/libs/serialization/test/Jamfile.v2 | 34 +---
branches/serialization_next_release/boost/libs/serialization/test/test_array.cpp | 2
branches/serialization_next_release/boost/libs/serialization/test/test_cyclic_ptrs.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_deque.cpp | 2
branches/serialization_next_release/boost/libs/serialization/test/test_exported.cpp | 47 ++---
branches/serialization_next_release/boost/libs/serialization/test/test_list.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_list_ptrs.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_map.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_mult_archive_types.cpp | 2
branches/serialization_next_release/boost/libs/serialization/test/test_no_rtti.cpp | 2
branches/serialization_next_release/boost/libs/serialization/test/test_optional.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_polymorphic_A.cpp | 2
branches/serialization_next_release/boost/libs/serialization/test/test_reset_object_address.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_set.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_simple_class.cpp | 2
branches/serialization_next_release/boost/libs/serialization/test/test_simple_class_ptr.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_tools.hpp | 36 ----
branches/serialization_next_release/boost/libs/serialization/test/test_variant.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_vector.cpp | 1
branches/serialization_next_release/boost/libs/serialization/test/test_void_cast.cpp | 6
21 files changed, 122 insertions(+), 324 deletions(-)
Added: branches/serialization_next_release/boost/libs/serialization/test/A.cpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/A.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,213 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// A.cpp simple class test
+
+// (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 <cassert>
+#include <cstdlib> // rand()
+#include <cmath> // fabs()
+#include <cstddef> // size_t
+
+#include <boost/config.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::rand;
+ using ::fabs;
+ using ::size_t;
+}
+#endif
+
+#include <boost/detail/workaround.hpp>
+#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
+#include <boost/archive/dinkumware.hpp>
+#endif
+
+#include "A.hpp"
+
+template<class S>
+void randomize(S &x)
+{
+ assert(0 == x.size());
+ for(;;){
+ unsigned int i = std::rand() % 27;
+ if(0 == i)
+ break;
+ x += static_cast<typename S::value_type>('a' - 1 + i);
+ }
+}
+
+template<class T>
+void accumulate(std::size_t & s, const T & t){
+ const char * tptr = (const char *)(& t);
+ unsigned int count = sizeof(t);
+ while(count-- > 0){
+ s += *tptr++;
+ }
+}
+
+A::operator std::size_t () const {
+ std::size_t retval = 0;
+ accumulate(retval, b);
+ #ifndef BOOST_NO_INT64_T
+ accumulate(retval, f);
+ accumulate(retval, g);
+ #endif
+ accumulate(retval, l);
+ accumulate(retval, m);
+ accumulate(retval, n);
+ accumulate(retval, o);
+ accumulate(retval, p);
+ accumulate(retval, q);
+ #ifndef BOOST_NO_CWCHAR
+ accumulate(retval, r);
+ #endif
+ accumulate(retval, c);
+ accumulate(retval, s);
+ accumulate(retval, t);
+ accumulate(retval, u);
+ accumulate(retval, v);
+ return retval;
+}
+
+A::A() :
+ b(true),
+ #ifndef BOOST_NO_INT64_T
+ f(std::rand() * std::rand()),
+ g(std::rand() * std::rand()),
+ #endif
+ l(static_cast<enum h>(std::rand() % 3)),
+ m(std::rand()),
+ n(std::rand()),
+ o(std::rand()),
+ p(std::rand()),
+ q(std::rand()),
+ #ifndef BOOST_NO_CWCHAR
+ r(std::rand()),
+ #endif
+ c(std::rand()),
+ s(std::rand()),
+ t(std::rand()),
+ u(std::rand()),
+ v(std::rand()),
+ w((float)std::rand()),
+ x((double)std::rand())
+{
+ randomize(y);
+ #ifndef BOOST_NO_STD_WSTRING
+ randomize(z);
+ #endif
+}
+
+bool A::operator==(const A &rhs) const
+{
+ if(b != rhs.b)
+ return false;
+ if(l != rhs.l)
+ return false;
+ #ifndef BOOST_NO_INT64_T
+ if(f != rhs.f)
+ return false;
+ if(g != rhs.g)
+ return false;
+ #endif
+ if(m != rhs.m)
+ return false;
+ if(n != rhs.n)
+ return false;
+ if(o != rhs.o)
+ return false;
+ if(p != rhs.p)
+ return false;
+ if(q != rhs.q)
+ return false;
+ #ifndef BOOST_NO_CWCHAR
+ if(r != rhs.r)
+ return false;
+ #endif
+ if(c != rhs.c)
+ return false;
+ if(s != rhs.s)
+ return false;
+ if(t != rhs.t)
+ return false;
+ if(u != rhs.u)
+ return false;
+ if(v != rhs.v)
+ return false;
+ if(w == 0 && std::fabs(rhs.w) > std::numeric_limits<float>::epsilon())
+ return false;
+ if(std::fabs(rhs.w/w - 1.0) > std::numeric_limits<float>::epsilon())
+ return false;
+ if(x == 0 && std::fabs(rhs.x - x) > std::numeric_limits<float>::epsilon())
+ return false;
+ if(std::fabs(rhs.x/x - 1.0) > std::numeric_limits<float>::epsilon())
+ return false;
+ if(0 != y.compare(rhs.y))
+ return false;
+ #ifndef BOOST_NO_STD_WSTRING
+ if(0 != z.compare(rhs.z))
+ return false;
+ #endif
+ return true;
+}
+
+inline bool A::operator!=(const A &rhs) const
+{
+ return ! (*this == rhs);
+}
+
+inline bool A::operator<(const A &rhs) const
+{
+ if(b != rhs.b)
+ return b < rhs.b;
+ #ifndef BOOST_NO_INT64_T
+ if(f != rhs.f)
+ return f < rhs.f;
+ if(g != rhs.g)
+ return g < rhs.g;
+ #endif
+ if(l != rhs.l )
+ return l < rhs.l;
+ if(m != rhs.m )
+ return m < rhs.m;
+ if(n != rhs.n )
+ return n < rhs.n;
+ if(o != rhs.o )
+ return o < rhs.o;
+ if(p != rhs.p )
+ return p < rhs.p;
+ if(q != rhs.q )
+ return q < rhs.q;
+ #ifndef BOOST_NO_CWCHAR
+ if(r != rhs.r )
+ return r < rhs.r;
+ #endif
+ if(c != rhs.c )
+ return c < rhs.c;
+ if(s != rhs.s )
+ return s < rhs.s;
+ if(t != rhs.t )
+ return t < rhs.t;
+ if(u != rhs.u )
+ return u < rhs.u;
+ if(v != rhs.v )
+ return v < rhs.v;
+ if(w != rhs.w )
+ return w < rhs.w;
+ if(x != rhs.x )
+ return x < rhs.x;
+ int i = y.compare(rhs.y);
+ if(i != 0 )
+ return i < 0;
+ #ifndef BOOST_NO_STD_WSTRING
+ int j = z.compare(rhs.z);
+ if(j != 0 )
+ return j < 0;
+ #endif
+ return false;
+}
Modified: branches/serialization_next_release/boost/libs/serialization/test/A.hpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/A.hpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/A.hpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -16,83 +16,97 @@
// See http://www.boost.org for updates, documentation, and revision history.
-#include <cassert>
-#include <cstdlib> // for rand()
-#include <cmath> // for fabs()
#include <cstddef> // size_t
+#include <string>
+
#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
- using ::rand;
- using ::fabs;
using ::size_t;
}
#endif
-//#include <boost/test/test_exec_monitor.hpp>
#include <boost/limits.hpp>
#include <boost/cstdint.hpp>
-#include <boost/detail/workaround.hpp>
-#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
-#include <boost/archive/dinkumware.hpp>
+#include <boost/serialization/access.hpp>
+
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+ #include <boost/detail/workaround.hpp>
+ #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
+ #include <boost/archive/dinkumware.hpp>
+ #endif
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/string.hpp>
-#include <boost/serialization/access.hpp>
-class A
+#ifndef DLL_DECL
+#define DLL_DECL
+#endif
+
+class DLL_DECL A
{
private:
friend class boost::serialization::access;
// note: from an aesthetic perspective, I would much prefer to have this
// defined out of line. Unfortunately, this trips a bug in the VC 6.0
// compiler. So hold our nose and put it her to permit running of tests.
+ // mscvc 6.0 requires template functions to be implemented. For this
+ // reason we can't make abstract.
+ #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+ template<class Archive>
+ void A::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+ ){
+ ar & BOOST_SERIALIZATION_NVP(b);
+ #ifndef BOOST_NO_INT64_T
+ ar & BOOST_SERIALIZATION_NVP(f);
+ ar & BOOST_SERIALIZATION_NVP(g);
+ #endif
+ #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
+ int i;
+ if(Archive::is_saving::value){
+ i = l;
+ ar & BOOST_SERIALIZATION_NVP(i);
+ }
+ else{
+ ar & BOOST_SERIALIZATION_NVP(i);
+ l = i;
+ }
+ #else
+ ar & BOOST_SERIALIZATION_NVP(l);
+ #endif
+ ar & BOOST_SERIALIZATION_NVP(m);
+ ar & BOOST_SERIALIZATION_NVP(n);
+ ar & BOOST_SERIALIZATION_NVP(o);
+ ar & BOOST_SERIALIZATION_NVP(p);
+ ar & BOOST_SERIALIZATION_NVP(q);
+ #ifndef BOOST_NO_CWCHAR
+ ar & BOOST_SERIALIZATION_NVP(r);
+ #endif
+ ar & BOOST_SERIALIZATION_NVP(c);
+ ar & BOOST_SERIALIZATION_NVP(s);
+ ar & BOOST_SERIALIZATION_NVP(t);
+ ar & BOOST_SERIALIZATION_NVP(u);
+ ar & BOOST_SERIALIZATION_NVP(v);
+ ar & BOOST_SERIALIZATION_NVP(w);
+ ar & BOOST_SERIALIZATION_NVP(x);
+ ar & BOOST_SERIALIZATION_NVP(y);
+ #ifndef BOOST_NO_STD_WSTRING
+ ar & BOOST_SERIALIZATION_NVP(z);
+ #endif
+ }
+ #endif
template<class Archive>
- void serialize(
+ DLL_DECL void serialize(
Archive &ar,
const unsigned int /* file_version */
- ){
- ar & BOOST_SERIALIZATION_NVP(b);
- #ifndef BOOST_NO_INT64_T
- ar & BOOST_SERIALIZATION_NVP(f);
- ar & BOOST_SERIALIZATION_NVP(g);
- #endif
- #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
- int i;
- if(Archive::is_saving::value){
- i = l;
- ar & BOOST_SERIALIZATION_NVP(i);
- }
- else{
- ar & BOOST_SERIALIZATION_NVP(i);
- l = i;
- }
- #else
- ar & BOOST_SERIALIZATION_NVP(l);
- #endif
- ar & BOOST_SERIALIZATION_NVP(m);
- ar & BOOST_SERIALIZATION_NVP(n);
- ar & BOOST_SERIALIZATION_NVP(o);
- ar & BOOST_SERIALIZATION_NVP(p);
- ar & BOOST_SERIALIZATION_NVP(q);
- #ifndef BOOST_NO_CWCHAR
- ar & BOOST_SERIALIZATION_NVP(r);
- #endif
- ar & BOOST_SERIALIZATION_NVP(c);
- ar & BOOST_SERIALIZATION_NVP(s);
- ar & BOOST_SERIALIZATION_NVP(t);
- ar & BOOST_SERIALIZATION_NVP(u);
- ar & BOOST_SERIALIZATION_NVP(v);
- ar & BOOST_SERIALIZATION_NVP(w);
- ar & BOOST_SERIALIZATION_NVP(x);
- ar & BOOST_SERIALIZATION_NVP(y);
- #ifndef BOOST_NO_STD_WSTRING
- ar & BOOST_SERIALIZATION_NVP(z);
- #endif
- }
+ );
bool b;
#ifndef BOOST_NO_INT64_T
boost::int64_t f;
@@ -133,189 +147,4 @@
friend std::istream & operator>>(std::istream & is, A & a);
};
-//BOOST_TEST_DONT_PRINT_LOG_VALUE(A);
-
-template<class S>
-void randomize(S &x)
-{
- assert(0 == x.size());
- for(;;){
- unsigned int i = std::rand() % 27;
- if(0 == i)
- break;
- x += static_cast<typename S::value_type>('a' - 1 + i);
- }
-}
-
-template<class T>
-void accumulate(std::size_t & s, const T & t){
- const char * tptr = (const char *)(& t);
- unsigned int count = sizeof(t);
- while(count-- > 0){
- s += *tptr++;
- }
-}
-
-A::operator std::size_t () const {
- std::size_t retval = 0;
- accumulate(retval, b);
- #ifndef BOOST_NO_INT64_T
- accumulate(retval, f);
- accumulate(retval, g);
- #endif
- accumulate(retval, l);
- accumulate(retval, m);
- accumulate(retval, n);
- accumulate(retval, o);
- accumulate(retval, p);
- accumulate(retval, q);
- #ifndef BOOST_NO_CWCHAR
- accumulate(retval, r);
- #endif
- accumulate(retval, c);
- accumulate(retval, s);
- accumulate(retval, t);
- accumulate(retval, u);
- accumulate(retval, v);
- return retval;
-}
-
-inline A::A() :
- b(true),
- #ifndef BOOST_NO_INT64_T
- f(std::rand() * std::rand()),
- g(std::rand() * std::rand()),
- #endif
- l(static_cast<enum h>(std::rand() % 3)),
- m(std::rand()),
- n(std::rand()),
- o(std::rand()),
- p(std::rand()),
- q(std::rand()),
- #ifndef BOOST_NO_CWCHAR
- r(std::rand()),
- #endif
- c(std::rand()),
- s(std::rand()),
- t(std::rand()),
- u(std::rand()),
- v(std::rand()),
- w((float)std::rand()),
- x((double)std::rand())
-{
- randomize(y);
- #ifndef BOOST_NO_STD_WSTRING
- randomize(z);
- #endif
-}
-
-inline bool A::operator==(const A &rhs) const
-{
- if(b != rhs.b)
- return false;
- if(l != rhs.l)
- return false;
- #ifndef BOOST_NO_INT64_T
- if(f != rhs.f)
- return false;
- if(g != rhs.g)
- return false;
- #endif
- if(m != rhs.m)
- return false;
- if(n != rhs.n)
- return false;
- if(o != rhs.o)
- return false;
- if(p != rhs.p)
- return false;
- if(q != rhs.q)
- return false;
- #ifndef BOOST_NO_CWCHAR
- if(r != rhs.r)
- return false;
- #endif
- if(c != rhs.c)
- return false;
- if(s != rhs.s)
- return false;
- if(t != rhs.t)
- return false;
- if(u != rhs.u)
- return false;
- if(v != rhs.v)
- return false;
- if(w == 0 && std::fabs(rhs.w) > std::numeric_limits<float>::epsilon())
- return false;
- if(std::fabs(rhs.w/w - 1.0) > std::numeric_limits<float>::epsilon())
- return false;
- if(x == 0 && std::fabs(rhs.x - x) > std::numeric_limits<float>::epsilon())
- return false;
- if(std::fabs(rhs.x/x - 1.0) > std::numeric_limits<float>::epsilon())
- return false;
- if(0 != y.compare(rhs.y))
- return false;
- #ifndef BOOST_NO_STD_WSTRING
- if(0 != z.compare(rhs.z))
- return false;
- #endif
- return true;
-}
-
-inline bool A::operator!=(const A &rhs) const
-{
- return ! (*this == rhs);
-}
-
-inline bool A::operator<(const A &rhs) const
-{
- if(b != rhs.b)
- return b < rhs.b;
- #ifndef BOOST_NO_INT64_T
- if(f != rhs.f)
- return f < rhs.f;
- if(g != rhs.g)
- return g < rhs.g;
- #endif
- if(l != rhs.l )
- return l < rhs.l;
- if(m != rhs.m )
- return m < rhs.m;
- if(n != rhs.n )
- return n < rhs.n;
- if(o != rhs.o )
- return o < rhs.o;
- if(p != rhs.p )
- return p < rhs.p;
- if(q != rhs.q )
- return q < rhs.q;
- #ifndef BOOST_NO_CWCHAR
- if(r != rhs.r )
- return r < rhs.r;
- #endif
- if(c != rhs.c )
- return c < rhs.c;
- if(s != rhs.s )
- return s < rhs.s;
- if(t != rhs.t )
- return t < rhs.t;
- if(u != rhs.u )
- return u < rhs.u;
- if(v != rhs.v )
- return v < rhs.v;
- if(w != rhs.w )
- return w < rhs.w;
- if(x != rhs.x )
- return x < rhs.x;
- int i = y.compare(rhs.y);
- if(i != 0 )
- return i < 0;
- #ifndef BOOST_NO_STD_WSTRING
- int j = z.compare(rhs.z);
- if(j != 0 )
- return j < 0;
- #endif
- return false;
-}
-
#endif // BOOST_SERIALIZATION_TEST_A_HPP
Added: branches/serialization_next_release/boost/libs/serialization/test/A.ipp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/A.ipp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,67 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// A.ipp simple class test
+
+// (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.
+
+#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+
+#include "A.hpp"
+
+#include <boost/detail/workaround.hpp>
+#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
+#include <boost/archive/dinkumware.hpp>
+#endif
+
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/string.hpp>
+
+template<class Archive>
+void A::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+){
+ ar & BOOST_SERIALIZATION_NVP(b);
+ #ifndef BOOST_NO_INT64_T
+ ar & BOOST_SERIALIZATION_NVP(f);
+ ar & BOOST_SERIALIZATION_NVP(g);
+ #endif
+ #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
+ int i;
+ if(Archive::is_saving::value){
+ i = l;
+ ar & BOOST_SERIALIZATION_NVP(i);
+ }
+ else{
+ ar & BOOST_SERIALIZATION_NVP(i);
+ l = i;
+ }
+ #else
+ ar & BOOST_SERIALIZATION_NVP(l);
+ #endif
+ ar & BOOST_SERIALIZATION_NVP(m);
+ ar & BOOST_SERIALIZATION_NVP(n);
+ ar & BOOST_SERIALIZATION_NVP(o);
+ ar & BOOST_SERIALIZATION_NVP(p);
+ ar & BOOST_SERIALIZATION_NVP(q);
+ #ifndef BOOST_NO_CWCHAR
+ ar & BOOST_SERIALIZATION_NVP(r);
+ #endif
+ ar & BOOST_SERIALIZATION_NVP(c);
+ ar & BOOST_SERIALIZATION_NVP(s);
+ ar & BOOST_SERIALIZATION_NVP(t);
+ ar & BOOST_SERIALIZATION_NVP(u);
+ ar & BOOST_SERIALIZATION_NVP(v);
+ ar & BOOST_SERIALIZATION_NVP(w);
+ ar & BOOST_SERIALIZATION_NVP(x);
+ ar & BOOST_SERIALIZATION_NVP(y);
+ #ifndef BOOST_NO_STD_WSTRING
+ ar & BOOST_SERIALIZATION_NVP(z);
+ #endif
+}
+
+#endif // workaround
\ No newline at end of file
Modified: branches/serialization_next_release/boost/libs/serialization/test/Jamfile.v2
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/Jamfile.v2 (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/Jamfile.v2 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -13,6 +13,7 @@
# import rules from the boost serialization test
# import ../util/test : test-bsl-run-no-lib ;
import ../util/test :
+ run-template
run-invoke
run-winvoke
test-bsl-run-no-lib
@@ -22,32 +23,19 @@
test-bsl-run_polymorphic_archive
;
-BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
+if 0 {
+lib dll_a
+ : dll_a.cpp
+ ../build//boost_serialization
+ :
+ <toolset>msvc:<cxxflags>/Gy
+ ;
-rule run-template ( test-name : sources * : requirements * ) {
- return [
- run
- $(sources)
- : # command
- : # input files
- : # requirements
- # toolset suppress-warnings
- <toolset>gcc:<cxxflags>"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy"
- <toolset>msvc-8.0:<cxxflags>"-wd4996"
- <toolset>borland:<cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
- # toolset optimizations
- <toolset>gcc:<cxxflags>"-ftemplate-depth-255"
- <toolset>msvc:<cxxflags>"-Gy"
- # toolset shared library support
- <toolset>como,<link>shared:<build>no
- <toolset>msvc,<stdlib>stlport,<link>shared:<build>no
- <toolset>cw,<link>static:<build>no
- $(requirements)
- : # test name
- $(test-name)
- ] ;
+test-suite "xxx" : [ run-template test_dll_one : test_dll_one.cpp dll_a ] ;
}
+BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
+
test-suite "serialization" :
[ test-bsl-run_files test_array ]
[ test-bsl-run_files test_binary ]
Added: branches/serialization_next_release/boost/libs/serialization/test/base.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/base.hpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,38 @@
+#ifndef BOOST_SERIALIZATION_TEST_BASE_HPP
+#define BOOST_SERIALIZATION_TEST_BASE_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
+// base.hpp simple class test
+
+// (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 <boost/serialization/access.hpp>
+#include <boost/serialization/is_abstract.hpp>
+
+#ifndef DLL_DECL
+#define DLL_DECL
+#endif
+
+class DLL_DECL polymorphic_base
+{
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive & /* ar */, const unsigned int /* file_version */);
+public:
+ // msvc 7.1 has a link time problem with making this abstract - look in to this
+ virtual ~polymorphic_base() {} /* = 0 */;
+};
+
+//BOOST_IS_ABSTRACT(polymorphic_base)
+
+#endif // BOOST_SERIALIZATION_TEST_BASE_HPP
Added: branches/serialization_next_release/boost/libs/serialization/test/derived2.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/derived2.hpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,39 @@
+#ifndef BOOST_SERIALIZATION_TEST_DERIVED2_HPP
+#define BOOST_SERIALIZATION_TEST_DERIVED2_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
+// derived2.hpp simple class test
+
+// (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 <boost/serialization/export.hpp>
+#include <boost/serialization/access.hpp>
+#include "base.hpp"
+
+#ifndef DLL_DECL
+#define DLL_DECL
+#endif
+
+class DLL_DECL polymorphic_derived2 : public polymorphic_base
+{
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive &ar, const unsigned int /* file_version */);
+public:
+ ~polymorphic_derived2(){}
+};
+
+// MWerks users can do this to make their code work
+BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)
+
+#endif // BOOST_SERIALIZATION_TEST_DERIVED2_HPP
Added: branches/serialization_next_release/boost/libs/serialization/test/dll_a.cpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/dll_a.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,50 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// dll_a.cpp
+
+// (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)
+
+// Build a dll which contains the serialization for a class A
+// used in testing distribution of serialization code in DLLS
+#include "test_decl.hpp"
+
+#define DLL_DECL EXPORT_DECL(BOOST_PP_EMPTY())
+#include "A.hpp"
+#include "A.ipp"
+#include "A.cpp"
+#undef DLL_DECL
+
+// instantiate code for text archives
+
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+template
+EXPORT_DECL(void) A::serialize(
+ boost::archive::text_oarchive &ar,
+ const unsigned int /* file_version */
+);
+template
+EXPORT_DECL(void) A::serialize(
+ boost::archive::text_iarchive &ar,
+ const unsigned int /* file_version */
+);
+
+// instantiate code for polymorphic archives
+
+#include <boost/archive/polymorphic_oarchive.hpp>
+#include <boost/archive/polymorphic_iarchive.hpp>
+
+template
+EXPORT_DECL(void) A::serialize(
+ boost::archive::polymorphic_oarchive &ar,
+ const unsigned int /* file_version */
+);
+template
+EXPORT_DECL(void) A::serialize(
+ boost::archive::polymorphic_iarchive &ar,
+ const unsigned int /* file_version */
+);
+
Added: branches/serialization_next_release/boost/libs/serialization/test/dll_base.cpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/dll_base.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,61 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// dll_base.cpp
+
+// (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)
+
+// Build a dll which contains the serialization for a class A
+// used in testing distribution of serialization code in DLLS
+#include <boost/serialization/export.hpp>
+
+#include "test_decl.hpp"
+#define DLL_DECL EXPORT_DECL(BOOST_PP_EMPTY())
+#include "base.hpp"
+#undef DLL_DECL
+
+// instantiate code for text archives
+
+#include <boost/serialization/nvp.hpp>
+
+template<class Archive>
+void polymorphic_base::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */){
+}
+
+// for some reason this is required at least by MSVC
+// given that its declared virtual .. = 0; This
+// seems wrong to me but here it is.
+polymorphic_base::~polymorphic_base(){}
+
+// instantiate code for text archives
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+// instantiate code for polymorphic archives
+#include <boost/archive/polymorphic_oarchive.hpp>
+#include <boost/archive/polymorphic_iarchive.hpp>
+
+// note: BOOST_CLASS_EXPORT cannot be used to instantiate
+// serialization code for an abstract base class. So use
+// explicit instantiation in this case.
+//BOOST_CLASS_EXPORT(polymorphic_base)
+
+template EXPORT_DECL(void) polymorphic_base::serialize(
+ boost::archive::text_oarchive & ar,
+ const unsigned int version
+);
+template EXPORT_DECL(void) polymorphic_base::serialize(
+ boost::archive::text_iarchive & ar,
+ const unsigned int version
+);
+template EXPORT_DECL(void) polymorphic_base::serialize(
+ boost::archive::polymorphic_oarchive & ar,
+ const unsigned int version
+);
+template EXPORT_DECL(void) polymorphic_base::serialize(
+ boost::archive::polymorphic_iarchive & ar,
+ const unsigned int version
+);
Added: branches/serialization_next_release/boost/libs/serialization/test/dll_derived2.cpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/dll_derived2.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,39 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// dll_derived2.cpp
+
+// (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)
+
+// Build a dll which contains the serialization for a class A
+// used in testing distribution of serialization code in DLLS
+#include "test_decl.hpp"
+
+#define DLL_DECL IMPORT_DECL
+#include "base.hpp"
+#undef DLL_DECL
+
+#define DLL_DECL EXPORT_DECL(BOOST_PP_EMPTY())
+#include "derived2.hpp"
+#undef DLL_DECL
+
+#include <boost/serialization/nvp.hpp>
+template<class Archive>
+void polymorphic_derived2::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+){
+ ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
+}
+
+// instantiate code for text archives
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+// instantiate code for polymorphic archives
+#include <boost/archive/polymorphic_oarchive.hpp>
+#include <boost/archive/polymorphic_iarchive.hpp>
+
+// note: export has to be AFTER #includes for all archive classes
+BOOST_CLASS_EXPORT(polymorphic_derived2)
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_array.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_array.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_array.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -21,8 +21,8 @@
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/archive/archive_exception.hpp>
-#include <boost/serialization/nvp.hpp>
#include "A.hpp"
+#include "A.ipp"
struct array_equal_to //: public std::binary_function<T, T, bool>
{
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_cyclic_ptrs.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_cyclic_ptrs.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_cyclic_ptrs.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -27,6 +27,7 @@
#include <boost/serialization/base_object.hpp>
#include "A.hpp"
+#include "A.ipp"
///////////////////////////////////////////////////////
// class with a member which refers to itself
Added: branches/serialization_next_release/boost/libs/serialization/test/test_decl.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_decl.hpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,60 @@
+#ifndef BOOST_TEST_DECL_HPP
+#define BOOST_TEST_DECL_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
+// test_decl.hpp
+//
+// © Copyright Robert Ramey 2004
+// 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 library home page at http://www.boost.org/libs/serialization
+// export if this is our own source, otherwise import:
+
+// usage:
+// class header declarations should look something like:
+// class DLL_DECL A {
+// ...
+// };
+//
+// code which includes such headers should look something like:
+//
+// #define DLL_DECL IMPORT_DECL
+// #include "A.hpp"
+// #undef DLL_DECL
+//
+// for declarations used in dlls for exporting, and
+//
+// #define DLL_DECL EXPORT_DECL
+// #include "A.hpp"
+// #include "A.ipp"
+// #undef DLL_DECL
+//
+// when a declaration is to be imported.
+#include <boost/config.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
+
+#ifdef BOOST_HAS_DECLSPEC // defined in config system
+ #if ! defined(EXPORT_DECL)
+ #if defined(__BORLANDC__)
+ #define EXPORT_DECL(T) T __export
+ #else
+ #define EXPORT_DECL(T) __declspec(dllexport) T
+ #endif
+ #endif
+ #if ! defined(IMPORT_DECL)
+ #if defined(__BORLANDC__)
+ #define IMPORT_DECL __import
+ #else
+ #define IMPORT_DECL __declspec(dllimport)
+ #endif
+ #endif
+#endif // BOOST_HAS_DECLSPEC
+
+#endif // BOOST_TEST_DECL_HPP
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_deque.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_deque.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_deque.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -22,7 +22,9 @@
#include "test_tools.hpp"
#include <boost/serialization/deque.hpp>
+
#include "A.hpp"
+#include "A.ipp"
int test_main( int /* argc */, char* /* argv */[] )
{
Added: branches/serialization_next_release/boost/libs/serialization/test/test_dll_exported.cpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_dll_exported.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,117 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// test_exported.cpp
+
+// (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)
+
+// should pass compilation and execution
+
+#include <fstream>
+
+#include <cstdio> // remove
+#include <boost/config.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::remove;
+}
+#endif
+
+#include <boost/archive/archive_exception.hpp>
+#include "test_tools.hpp"
+#include "test_decl.hpp"
+
+#define DLL_DECL IMPORT_DECL
+#include "base.hpp"
+#undef DLL_DECL
+
+#include <boost/serialization/base_object.hpp>
+#include <boost/serialization/export.hpp>
+#include <boost/serialization/type_info_implementation.hpp>
+#include <boost/serialization/access.hpp>
+
+class polymorphic_derived1 : public polymorphic_base
+{
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive &ar, const unsigned int /* file_version */){
+ ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
+ }
+public:
+ 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)
+
+#define DLL_DECL IMPORT_DECL
+#include "derived2.hpp"
+#undef DLL_DECL
+
+// save exported polymorphic class
+void save_exported(const char *testfile)
+{
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+
+ polymorphic_base *rb1 = new polymorphic_derived1;
+ polymorphic_base *rb2 = new polymorphic_derived2;
+
+ // export will permit correct serialization
+ // through a pointer to a base class
+ oa << BOOST_SERIALIZATION_NVP(rb1);
+ oa << BOOST_SERIALIZATION_NVP(rb2);
+
+ delete rb1;
+ delete rb2;
+}
+
+// save exported polymorphic class
+void load_exported(const char *testfile)
+{
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+
+ polymorphic_base *rb1 = NULL;
+ polymorphic_base *rb2 = NULL;
+
+ // export will permit correct serialization
+ // through a pointer to a base class
+ ia >> BOOST_SERIALIZATION_NVP(rb1);
+ BOOST_CHECK_MESSAGE(
+ boost::serialization::type_info_implementation<polymorphic_derived1>
+ ::type::get_const_instance()
+ ==
+ * boost::serialization::type_info_implementation<polymorphic_base>
+ ::type::get_const_instance().get_derived_extended_type_info(*rb1),
+ "restored pointer b1 not of correct type"
+ );
+ ia >> BOOST_SERIALIZATION_NVP(rb2);
+ BOOST_CHECK_MESSAGE(
+ boost::serialization::type_info_implementation<polymorphic_derived2>
+ ::type::get_const_instance()
+ ==
+ * boost::serialization::type_info_implementation<polymorphic_base>
+ ::type::get_const_instance().get_derived_extended_type_info(*rb2),
+ "restored pointer b2 not of correct type"
+ );
+ delete rb1;
+ delete rb2;
+}
+
+int
+test_main( int /* argc */, char* /* argv */[] )
+{
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ save_exported(testfile);
+ load_exported(testfile);
+ std::remove(testfile);
+ return EXIT_SUCCESS;
+}
+
+// EOF
Added: branches/serialization_next_release/boost/libs/serialization/test/test_dll_simple.cpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_dll_simple.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -0,0 +1,235 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// test_dll_simple.cpp
+
+// (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)
+
+// should pass compilation and execution
+
+// invoke header for a custom archive test.
+
+#include <fstream>
+
+#include <cstdio> // remove
+#include <boost/config.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::remove;
+}
+#endif
+
+#include "test_tools.hpp"
+
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include <boost/archive/polymorphic_text_oarchive.hpp>
+#include <boost/archive/polymorphic_text_iarchive.hpp>
+
+#include "test_decl.hpp"
+#define DLL_DECL IMPORT_DECL
+#include "A.hpp"
+#undef DLL_DECL
+
+// simple class with text archive compiled in dll
+void
+test1(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ A a, a1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("a", a);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("a", a1);
+ }
+ BOOST_CHECK_EQUAL(a, a1);
+
+ std::remove(testfile);
+}
+
+// simple class with polymorphic archive compiled in dll
+void
+test2(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ A a, a1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("a", a);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("a", a1);
+ }
+ BOOST_CHECK_EQUAL(a, a1);
+
+ std::remove(testfile);
+}
+
+// simple class pointer with text archive compiled in dll
+void
+test3(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ A *a = & A();
+ A *a1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("a", a);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("a", a1);
+ }
+ BOOST_CHECK_EQUAL(*a, *a1);
+
+ std::remove(testfile);
+}
+
+// simple class pointer with polymorphic archive compiled in dll
+void
+test4(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ A *a = & A();
+ A *a1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("a", a);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("a", a1);
+ }
+ BOOST_CHECK_EQUAL(*a, *a1);
+
+ std::remove(testfile);
+}
+
+#define DLL_DECL IMPORT_DECL
+#include "B.hpp"
+#undef DLL_DECL
+
+// derived class with base text archive compiled in dll
+void
+test5(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ B b, b1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("b", b);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("b", b1);
+ }
+ BOOST_CHECK_EQUAL(b, b1);
+
+ std::remove(testfile);
+}
+
+// derived class with base base compiled with polymorphic archive in dll
+void
+test6(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ B b, b1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("b", b);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("b", b1);
+ }
+ BOOST_CHECK_EQUAL(b, b1);
+
+ std::remove(testfile);
+}
+
+// derived class pointer with base text archive compiled in dll
+void
+test7(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ B *b = & B();
+ B *b1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("b", b);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("b", b1);
+ }
+ BOOST_CHECK_EQUAL(*b, *b1);
+
+ std::remove(testfile);
+}
+
+// derived class pointer with base polymorphic archive compiled in dll
+void
+test8(){
+ const char * testfile = boost::archive::tmpnam(NULL);
+ BOOST_REQUIRE(NULL != testfile);
+
+ B *b = & B();
+ B *b1;
+ {
+ test_ostream os(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS);
+ oa << boost::serialization::make_nvp("b", b);
+ }
+ {
+ test_istream is(testfile, TEST_STREAM_FLAGS);
+ boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS);
+ ia >> boost::serialization::make_nvp("b", b1);
+ }
+ BOOST_CHECK_EQUAL(*b, *b1);
+
+ std::remove(testfile);
+}
+
+
+int
+test_main( int /* argc */, char* /* argv */[] )
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ return EXIT_SUCCESS;
+}
+
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_exported.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_exported.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_exported.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -25,17 +25,13 @@
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
-class polymorphic_base
-{
- friend class boost::serialization::access;
- template<class Archive>
- void serialize(Archive & /* ar */, const unsigned int /* file_version */){
- }
-public:
- virtual ~polymorphic_base(){};
-};
+#include "base.hpp"
-BOOST_IS_ABSTRACT(polymorphic_base)
+template<class Archive>
+void polymorphic_base::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */){
+}
class polymorphic_derived1 : public polymorphic_base
{
@@ -45,7 +41,7 @@
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
}
public:
- virtual ~polymorphic_derived1(){}
+ ~polymorphic_derived1(){}
};
BOOST_CLASS_EXPORT(polymorphic_derived1)
@@ -53,22 +49,17 @@
// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1)
-class polymorphic_derived2 : public polymorphic_base
-{
- friend class boost::serialization::access;
- template<class Archive>
- void serialize(Archive &ar, const unsigned int /* file_version */){
- ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
- }
-public:
- virtual ~polymorphic_derived2(){}
-};
+#include "derived2.hpp"
+template<class Archive>
+void polymorphic_derived2::serialize(
+ Archive &ar,
+ const unsigned int /* file_version */
+){
+ ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
+}
BOOST_CLASS_EXPORT(polymorphic_derived2)
-// MWerks users can do this to make their code work
-BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)
-
// save exported polymorphic class
void save_exported(const char *testfile)
{
@@ -100,20 +91,20 @@
// through a pointer to a base class
ia >> BOOST_SERIALIZATION_NVP(rb1);
BOOST_CHECK_MESSAGE(
- & boost::serialization::type_info_implementation<polymorphic_derived1>
+ boost::serialization::type_info_implementation<polymorphic_derived1>
::type::get_const_instance()
==
- boost::serialization::type_info_implementation<polymorphic_base>
+ * boost::serialization::type_info_implementation<polymorphic_base>
::type::get_const_instance().get_derived_extended_type_info(*rb1),
"restored pointer b1 not of correct type"
);
ia >> BOOST_SERIALIZATION_NVP(rb2);
BOOST_CHECK_MESSAGE(
- & boost::serialization::type_info_implementation<polymorphic_derived2>
+ boost::serialization::type_info_implementation<polymorphic_derived2>
::type::get_const_instance()
==
- boost::serialization::type_info_implementation<polymorphic_base>
+ * boost::serialization::type_info_implementation<polymorphic_base>
::type::get_const_instance().get_derived_extended_type_info(*rb2),
"restored pointer b2 not of correct type"
);
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_list.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_list.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_list.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -27,6 +27,7 @@
#endif
#include "A.hpp"
+#include "A.ipp"
int test_main( int /* argc */, char* /* argv */[] )
{
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_list_ptrs.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_list_ptrs.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_list_ptrs.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -32,6 +32,7 @@
#include <boost/serialization/nvp.hpp>
#include "A.hpp"
+#include "A.ipp"
template<class T>
struct ptr_equal_to : public std::binary_function<T, T, bool>
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_map.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_map.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_map.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -30,6 +30,7 @@
#include <boost/serialization/map.hpp>
#include "A.hpp"
+#include "A.ipp"
///////////////////////////////////////////////////////
// a key value initialized with a random value for use
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_mult_archive_types.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_mult_archive_types.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_mult_archive_types.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -42,6 +42,7 @@
virtual ~A(){--count;} // default destructor
};
+BOOST_CLASS_EXPORT(A)
// B is a subclass of A
class B : public A
@@ -59,7 +60,6 @@
virtual ~B() {};
};
-BOOST_CLASS_EXPORT(A)
BOOST_CLASS_EXPORT(B)
int A::count = 0;
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_no_rtti.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_no_rtti.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_no_rtti.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -55,7 +55,7 @@
extended_type_info_no_rtti<polymorphic_base>
)
// note: types which use ...no_rtti MUST be exported
-BOOST_CLASS_EXPORT(polymorphic_base)
+// BOOST_CLASS_EXPORT(polymorphic_base)
class polymorphic_derived1 : public polymorphic_base
{
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_optional.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_optional.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_optional.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -25,6 +25,7 @@
#include <boost/serialization/optional.hpp>
#include "A.hpp"
+#include "A.ipp"
int test_main( int /* argc */, char* /* argv */[] )
{
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_polymorphic_A.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_polymorphic_A.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_polymorphic_A.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -8,7 +8,9 @@
#include "test_polymorphic_A.hpp"
#include <boost/serialization/nvp.hpp>
+
#include "A.hpp"
+#include "A.ipp"
data::data() :
a(new A)
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_reset_object_address.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_reset_object_address.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_reset_object_address.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -35,6 +35,7 @@
// simple test of untracked value
#include "A.hpp"
+#include "A.ipp"
void test1(){
std::stringstream ss;
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_set.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_set.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_set.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -30,6 +30,7 @@
#include <boost/serialization/set.hpp>
#include "A.hpp"
+#include "A.ipp"
void
test_set(){
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_simple_class.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_simple_class.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_simple_class.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -23,8 +23,8 @@
#include "test_tools.hpp"
-#include <boost/serialization/nvp.hpp>
#include "A.hpp"
+#include "A.ipp"
int
test_main( int /* argc */, char* /* argv */[] )
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_simple_class_ptr.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_simple_class_ptr.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_simple_class_ptr.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -21,6 +21,7 @@
#include "test_tools.hpp"
#include "A.hpp"
+#include "A.ipp"
int test_main( int /* argc */, char* /* argv */[] )
{
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_tools.hpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_tools.hpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_tools.hpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -82,30 +82,6 @@
}
return name;
}
-#if 0
- char * tmpnam(char * buffer){
- char old_dir[256];
- _getcwd(old_dir, sizeof(old_dir) - 1);
-
- char * temp_dir = boost::archive::tmpdir();
- chdir(temp_dir);
-
- char temp_name[256];
- std::tmpnam(temp_name);
-
- chdir(old_dir);
- static char ibuffer [512];
-
- if(NULL == buffer)
- buffer = ibuffer;
-
- STRCPY(buffer, temp_dir);
- std::strcat(buffer, temp_name);
- return buffer;
- }
-#endif
-
-
} // archive
} // boost
@@ -177,22 +153,23 @@
int
main(int argc, char * argv[]){
- boost::serialization::global_lock::get_mutable_instance().lock();
+
+ boost::serialization::singleton_module::lock();
BOOST_TRY{
test_main(argc, argv);
}
#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
BOOST_CATCH(const std::exception e){
- BOOST_FAIL(e.what());
+ BOOST_ERROR(e.what());
}
#endif
BOOST_CATCH(...){
- BOOST_FAIL("failed with uncaught exception:");
+ BOOST_ERROR("failed with uncaught exception:");
}
BOOST_CATCH_END
- boost::serialization::global_lock::get_mutable_instance().unlock();
+ boost::serialization::singleton_module::unlock();
return boost::report_errors();
}
@@ -218,9 +195,6 @@
#define BOOST_ARCHIVE_TEST text_archive.hpp
#endif
-//#undef BOOST_ARCHIVE_TEST
-//#define BOOST_ARCHIVE_TEST portable_le_binary_archive.hpp
-
#include <boost/preprocessor/stringize.hpp>
#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_variant.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_variant.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_variant.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -42,6 +42,7 @@
#include <boost/serialization/variant.hpp>
#include "A.hpp"
+#include "A.ipp"
class are_equal
: public boost::static_visitor<bool>
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_vector.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_vector.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_vector.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -23,6 +23,7 @@
#include <boost/serialization/vector.hpp>
#include "A.hpp"
+#include "A.ipp"
template <class T>
int test_vector(T)
Modified: branches/serialization_next_release/boost/libs/serialization/test/test_void_cast.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/test/test_void_cast.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/test/test_void_cast.cpp 2007-11-22 01:10:24 EST (Thu, 22 Nov 2007)
@@ -10,6 +10,7 @@
#include "test_tools.hpp"
#include <boost/serialization/extended_type_info_typeid.hpp>
#include <boost/serialization/void_cast.hpp>
+#include <boost/serialization/singleton.hpp>
class Base1
{
@@ -33,8 +34,9 @@
template<class T>
const boost::serialization::extended_type_info & eti(){
- return boost::serialization::extended_type_info_typeid<T>
- ::get_const_instance();
+ return boost::serialization::singleton<
+ boost::serialization::extended_type_info_typeid<T>
+ >::get_const_instance();
}
int
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