changes to support DLL

[SVN r26863]
This commit is contained in:
Robert Ramey
2005-01-27 16:54:04 +00:00
parent daf73621a9
commit 1424df05ae
18 changed files with 139 additions and 132 deletions

View File

@@ -7,7 +7,7 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_iserializer.hpp: extenstion of type_info required for serialization.
// archive_pointer_iserializer.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
@@ -23,6 +23,8 @@
#include <boost/archive/detail/basic_serializer.hpp>
#include <boost/archive/detail/basic_pointer_iserializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
@@ -33,9 +35,11 @@ namespace archive {
namespace detail {
template<class Archive>
class archive_pointer_iserializer : public basic_pointer_iserializer {
class archive_pointer_iserializer :
public basic_pointer_iserializer {
protected:
explicit archive_pointer_iserializer(
explicit BOOST_DECL_ARCHIVE_OR_WARCHIVE
archive_pointer_iserializer(
const boost::serialization::extended_type_info & type_
);
public:
@@ -66,7 +70,9 @@ public:
// 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 const basic_pointer_iserializer * find(
BOOST_DECL_ARCHIVE_OR_WARCHIVE
static const
basic_pointer_iserializer * find(
const boost::serialization::extended_type_info & type_
);
@@ -77,4 +83,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_ARCHIVE_POINTER_ISERIALIZER_POINTER_HPP

View File

@@ -20,6 +20,8 @@
#include <boost/archive/detail/basic_serializer.hpp>
#include <boost/archive/detail/basic_pointer_oserializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
@@ -30,9 +32,11 @@ namespace archive {
namespace detail {
template<class Archive>
class archive_pointer_oserializer : public basic_pointer_oserializer {
class archive_pointer_oserializer :
public basic_pointer_oserializer {
protected:
explicit archive_pointer_oserializer(
explicit BOOST_DECL_ARCHIVE_OR_WARCHIVE
archive_pointer_oserializer(
const boost::serialization::extended_type_info & type_
);
public:
@@ -40,7 +44,9 @@ public:
// 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 const basic_pointer_oserializer * find(
BOOST_DECL_ARCHIVE_OR_WARCHIVE
static const basic_pointer_oserializer *
find(
const boost::serialization::extended_type_info & type_
);
virtual ~archive_pointer_oserializer(){}
@@ -50,4 +56,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_ARCHIVE_POINTER_OSERIALIZER_POINTER_HPP

View File

@@ -1,5 +1,5 @@
#ifndef BOOST_ARCHIVE_BASIC_IARCHIVE_HPP
#define BOOST_ARCHIVE_BASIC_IARCHIVE_HPP
#ifndef BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
@@ -16,14 +16,13 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
// can't use this - much as I'd like to as borland doesn't support it
// #include <boost/scoped_ptr.hpp>
#include <boost/serialization/tracking.hpp>
#include <boost/archive/basic_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
@@ -34,11 +33,11 @@ namespace archive {
namespace detail {
class basic_iarchive_impl;
class basic_iserializer;
class basic_pointer_iserializer;
class BOOST_DECL_ARCHIVE basic_iserializer;
class BOOST_DECL_ARCHIVE basic_pointer_iserializer;
//////////////////////////////////////////////////////////////////////
// class basic_iarchive - read serialized objects from a input stream
class basic_iarchive
class BOOST_DECL_ARCHIVE basic_iarchive
{
friend class basic_iarchive_impl;
// hide implementation of this class to minimize header conclusion
@@ -57,15 +56,11 @@ public: // note: not part of the public API.
void
next_object_pointer(void *t);
protected:
void init(unsigned int archive_library_version_){
archive_library_version = archive_library_version_;
}
void init(unsigned int archive_library_version_);
basic_iarchive();
virtual ~basic_iarchive();
public:
unsigned int library_version() const{
return archive_library_version;
}
unsigned int library_version() const;
void load_object(
void *t,
const basic_iserializer & bis
@@ -91,4 +86,6 @@ BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
boost::archive::detail::basic_iarchive
)
#endif //BOOST_ARCHIVE_BASIC_IARCHIVE_HPP
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP

View File

@@ -17,8 +17,12 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <cassert>
#include <cstdlib> // NULL
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/basic_serializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
@@ -29,30 +33,27 @@ namespace serialization {
namespace archive {
namespace detail {
class basic_iarchive;
class basic_pointer_iserializer;
class BOOST_DECL_ARCHIVE basic_iarchive;
class BOOST_DECL_ARCHIVE basic_pointer_iserializer;
class basic_iserializer : public basic_serializer
class BOOST_DECL_ARCHIVE basic_iserializer : public basic_serializer
{
private:
basic_pointer_iserializer *bpis_ptr;
basic_pointer_iserializer *bpis;
protected:
explicit basic_iserializer(
const boost::serialization::extended_type_info & type_
) :
basic_serializer(type_),
bpis_ptr(NULL)
{}
virtual ~basic_iserializer(){}
const boost::serialization::extended_type_info & type_
);
virtual ~basic_iserializer();
public:
bool serialized_as_pointer() const {
return bpis_ptr != NULL;
return bpis != NULL;
}
void set_bpis(basic_pointer_iserializer *bpis_ptr_){
bpis_ptr = bpis_ptr_;
void set_bpis(basic_pointer_iserializer *bpis_){
bpis = bpis_;
}
const basic_pointer_iserializer * get_bpis_ptr() const {
return bpis_ptr;
return bpis;
}
#if 0
virtual void load_object_data(
@@ -83,4 +84,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP

View File

@@ -17,7 +17,6 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
// can't use this - much as I'd like to as borland doesn't support it
@@ -26,16 +25,18 @@
#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/tracking.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
namespace detail {
class basic_oarchive_impl;
class basic_oserializer;
class basic_pointer_oserializer;
class BOOST_DECL_ARCHIVE basic_oarchive_impl;
class BOOST_DECL_ARCHIVE basic_oserializer;
class BOOST_DECL_ARCHIVE basic_pointer_oserializer;
//////////////////////////////////////////////////////////////////////
// class basic_oarchive - write serialized objects to an output stream
class basic_oarchive
class BOOST_DECL_ARCHIVE basic_oarchive
{
friend class basic_oarchive_impl;
// hide implementation of this class to minimize header conclusion
@@ -59,9 +60,7 @@ protected:
virtual ~basic_oarchive();
public:
unsigned int library_version() const{
return ARCHIVE_VERSION;
}
unsigned int library_version() const;
void save_object(
const void *x,
const basic_oserializer & bos
@@ -72,20 +71,21 @@ public:
);
void register_basic_serializer(const basic_oserializer & bos);
void save_null_pointer(){
vsave(null_pointer_tag);
vsave(NULL_POINTER_TAG);
}
void end_preamble(){} // default implementation does nothing
void end_preamble(); // default implementation does nothing
};
} // namespace detail
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
boost::archive::detail::basic_oarchive
)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP

View File

@@ -16,8 +16,12 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <cstdlib> // NULL
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/basic_serializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
@@ -28,21 +32,19 @@ namespace serialization {
namespace archive {
namespace detail {
class basic_oarchive;
class basic_pointer_oserializer;
class BOOST_DECL_ARCHIVE basic_oarchive;
class BOOST_DECL_ARCHIVE basic_pointer_oserializer;
class basic_oserializer : public basic_serializer
class BOOST_DECL_ARCHIVE basic_oserializer :
public basic_serializer
{
private:
basic_pointer_oserializer *bpos;
protected:
explicit basic_oserializer(
const boost::serialization::extended_type_info & type_
) :
basic_serializer(type_),
bpos(NULL)
{}
virtual ~basic_oserializer(){}
const boost::serialization::extended_type_info & type_
);
virtual ~basic_oserializer();
public:
bool serialized_as_pointer() const {
return bpos != NULL;
@@ -70,4 +72,6 @@ public:
} // namespace serialization
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP

View File

@@ -17,25 +17,27 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/basic_serializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
// forward declarations
namespace archive {
namespace detail {
class basic_iarchive;
class basic_iserializer;
class BOOST_DECL_ARCHIVE basic_iarchive;
class BOOST_DECL_ARCHIVE basic_iserializer;
class basic_pointer_iserializer : public basic_serializer {
class BOOST_DECL_ARCHIVE basic_pointer_iserializer
: public basic_serializer {
protected:
explicit basic_pointer_iserializer(
const boost::serialization::extended_type_info & type_
) :
basic_serializer(type_)
{}
virtual ~basic_pointer_iserializer(){};
);
virtual ~basic_pointer_iserializer();
public:
virtual const basic_iserializer & get_basic_serializer() const = 0;
virtual void load_object_ptr(
@@ -49,4 +51,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_ISERIALIZER_HPP

View File

@@ -17,8 +17,11 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/basic_serializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
@@ -28,17 +31,15 @@ namespace serialization {
namespace archive {
namespace detail {
class basic_oarchive;
class basic_oserializer;
class BOOST_DECL_ARCHIVE basic_oarchive;
class BOOST_DECL_ARCHIVE basic_oserializer;
class basic_pointer_oserializer : public basic_serializer {
class BOOST_DECL_ARCHIVE basic_pointer_oserializer : public basic_serializer {
protected:
explicit basic_pointer_oserializer(
const boost::serialization::extended_type_info & type_
) :
basic_serializer(type_)
{}
virtual ~basic_pointer_oserializer(){};
);
virtual ~basic_pointer_oserializer();
public:
virtual const basic_oserializer & get_basic_serializer() const = 0;
virtual void save_object_ptr(
@@ -51,4 +52,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_BASIC_ARCHIVE_POINTER_OSERIALIZER_HPP

View File

@@ -17,6 +17,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/noncopyable.hpp>
#include <boost/config.hpp>
#include <boost/serialization/extended_type_info.hpp>
namespace boost {

View File

@@ -18,6 +18,11 @@
#include <set>
#include <boost/config.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace serialization {
class extended_type_info;
@@ -26,7 +31,7 @@ namespace serialization {
namespace archive {
namespace detail {
class basic_serializer;
class BOOST_DECL_ARCHIVE basic_serializer;
struct type_info_pointer_compare
{
@@ -37,7 +42,7 @@ struct type_info_pointer_compare
}
};
struct basic_serializer_map
struct BOOST_DECL_ARCHIVE basic_serializer_map
{
typedef std::set<const basic_serializer *, type_info_pointer_compare> map_type;
map_type map;
@@ -45,10 +50,13 @@ struct basic_serializer_map
const basic_serializer * tfind(
const boost::serialization::extended_type_info & type_
) const;
basic_serializer_map();
};
} // namespace detail
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_TYPEINFO_EXTENDED_MAP_HPP

View File

@@ -18,8 +18,6 @@
#include <boost/throw_exception.hpp>
#include <boost/config.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
@@ -59,27 +57,6 @@ protected:
void load_start(const char *name){}
void load_end(const char *name){}
// default archive initialization
void init(){
// read signature in an archive version independent manner
std::string file_signature;
* this->This() >> file_signature;
if(file_signature != ARCHIVE_SIGNATURE)
boost::throw_exception(
archive_exception(archive_exception::invalid_signature)
);
// make sure the version of the reading archive library can
// support the format of the archive being read
version_type input_library_version;
* this->This() >> input_library_version;
basic_iarchive::init(input_library_version);
const unsigned int current_library_version = ARCHIVE_VERSION;
// extra little .t is to get around borland quirk
if(current_library_version < input_library_version.t)
boost::throw_exception(
archive_exception(archive_exception::unsupported_version)
);
}
common_iarchive() :
basic_iarchive(),
interface_iarchive<Archive>()

View File

@@ -57,13 +57,6 @@ private:
protected:
void save_start(const char *name){}
void save_end(const char *name){}
void init(){
// write signature in an archive version independent manner
const std::string file_signature(ARCHIVE_SIGNATURE);
* this->This() << file_signature;
// write library version
* this->This() << ARCHIVE_VERSION;
}
common_oarchive() :
basic_oarchive(),
interface_oarchive<Archive>()

View File

@@ -16,19 +16,17 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <string>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/archive/detail/iserializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
namespace detail {
class basic_iserializer;
class basic_pointer_iserializer;
class BOOST_DECL_ARCHIVE basic_pointer_iserializer;
template<class Archive>
class interface_iarchive
@@ -117,4 +115,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP

View File

@@ -16,22 +16,21 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <string>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/cstdint.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/static_warning.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/level.hpp>
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
namespace detail {
class basic_oserializer;
class basic_pointer_oserializer;
class BOOST_DECL_ARCHIVE basic_oserializer;
class BOOST_DECL_ARCHIVE basic_pointer_oserializer;
template<class Archive>
class interface_oarchive
@@ -116,4 +115,6 @@ public:
} // namespace archive
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP

View File

@@ -77,7 +77,6 @@ namespace std{
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -152,7 +151,7 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
) const {
// make sure call is routed through the higest interface that might
// be specialized by the user.
boost::serialization::serialize_adl<Archive, T>(
boost::serialization::serialize_adl(
boost::smart_cast_reference<Archive &>(ar),
* static_cast<T *>(x),
file_version
@@ -373,10 +372,12 @@ struct load_pointer_type {
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
return static_cast<basic_pointer_iserializer *>(NULL);
}
};

View File

@@ -70,7 +70,6 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -145,7 +144,7 @@ inline BOOST_DLLEXPORT void oserializer<Archive, T>::save_object_data(
) const {
// make sure call is routed through the highest interface that might
// be specialized by the user.
boost::serialization::serialize_adl<Archive, T>(
boost::serialization::serialize_adl(
boost::smart_cast_reference<Archive &>(ar),
* static_cast<T *>(const_cast<void *>(x)),
version()
@@ -223,7 +222,9 @@ struct save_non_pointer_type {
// make sure call is routed through the highest interface that might
// be specialized by the user.
boost::serialization::serialize_adl(
ar, const_cast<T &>(t), ::boost::serialization::version<T>::value
ar,
const_cast<T &>(t),
::boost::serialization::version<T>::value
);
}
};

View File

@@ -30,13 +30,14 @@ namespace std{
#endif
#include <boost/archive/polymorphic_iarchive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
namespace detail{
class basic_iserializer;
class basic_pointer_iserializer;
class BOOST_DECL_ARCHIVE basic_iserializer;
class BOOST_DECL_ARCHIVE basic_pointer_iserializer;
template<class ArchiveImplementation>
class polymorphic_iarchive_impl :
@@ -141,7 +142,7 @@ private:
ArchiveImplementation::load_end(name);
}
virtual void register_basic_serializer(const detail::basic_iserializer & bis){
virtual void register_basic_serializer(const basic_iserializer & bis){
ArchiveImplementation::register_basic_serializer(bis);
}
public:
@@ -188,16 +189,14 @@ public:
std::basic_istream<_Elem, _Tr> & is,
unsigned int flags = 0
) :
ArchiveImplementation(is, flags | boost::archive::no_header)
{
// postpone archive initialization until build is complete
if(0 == flags & no_header)
ArchiveImplementation::init();
}
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_IMPL_HPP

View File

@@ -30,13 +30,14 @@ namespace std{
#endif
#include <boost/archive/polymorphic_oarchive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
namespace detail{
class basic_oserializer;
class basic_pointer_oserializer;
class BOOST_DECL_ARCHIVE basic_oserializer;
class BOOST_DECL_ARCHIVE basic_pointer_oserializer;
template<class ArchiveImplementation>
class polymorphic_oarchive_impl :
@@ -188,16 +189,14 @@ public:
std::basic_ostream<_Elem, _Tr> & os,
unsigned int flags = 0
) :
ArchiveImplementation(os, flags | no_header)
{
// postpone archive initialization until build is complete
if(0 == (flags & no_header))
ArchiveImplementation::init();
}
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_IMPL_HPP