mirror of
https://github.com/boostorg/serialization.git
synced 2026-01-26 19:12:08 +00:00
Merge trunk to release
[SVN r55350]
This commit is contained in:
@@ -12,8 +12,6 @@
|
||||
# pragma warning (disable : 4786) // too long name, harmless warning
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> // for NULL
|
||||
|
||||
#define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/archive/detail/basic_serializer.hpp>
|
||||
#include <boost/archive/detail/basic_serializer_map.hpp>
|
||||
@@ -25,61 +23,57 @@ namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
#if 0
|
||||
BOOST_ARCHIVE_DECL(bool)
|
||||
type_info_pointer_compare::operator()(
|
||||
const basic_serializer * lhs, const basic_serializer * rhs
|
||||
) const {
|
||||
return *lhs < *rhs;
|
||||
// note: We can't implement this as an associative
|
||||
// container as such a container might be dependent
|
||||
// upon the extended_type_info::m_key which might not
|
||||
// be assigned until later. So we use a "slower" method.
|
||||
// This not a big deal however as the slower "find" operations
|
||||
// operations are only called occasionally:
|
||||
// a) At module unloading
|
||||
// b) Once per input archive - the value is cached in the archive
|
||||
// implemenation.
|
||||
|
||||
BOOST_ARCHIVE_DECL(void)
|
||||
basic_serializer_map::insert(const basic_serializer * bs){
|
||||
m_map.push_back(bs);
|
||||
}
|
||||
|
||||
class basic_serializer_arg : public basic_serializer {
|
||||
BOOST_ARCHIVE_DECL(void)
|
||||
basic_serializer_map::erase(const basic_serializer * bs){
|
||||
map_type::iterator it = m_map.begin();
|
||||
map_type::iterator it_end = m_map.end();
|
||||
it = std::find(it, it_end, bs);
|
||||
if(it != it_end){
|
||||
m_map.erase(it);
|
||||
}
|
||||
else
|
||||
assert(false); // this should never occur
|
||||
}
|
||||
|
||||
class equals {
|
||||
const boost::serialization::extended_type_info * m_eti;
|
||||
public:
|
||||
basic_serializer_arg(const serialization::extended_type_info & eti) :
|
||||
basic_serializer(eti)
|
||||
bool operator()(const basic_serializer * bs) const {
|
||||
return *m_eti == bs->get_eti();
|
||||
}
|
||||
equals(const boost::serialization::extended_type_info * eti) :
|
||||
m_eti(eti)
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
// find the "oldest" matching pointer serializer
|
||||
BOOST_ARCHIVE_DECL(const basic_serializer *)
|
||||
basic_serializer_map::find(
|
||||
const boost::serialization::extended_type_info & eti
|
||||
) const {
|
||||
map_type::const_iterator it = m_map.begin();
|
||||
map_type::const_iterator it_end = m_map.end();
|
||||
it = std::find_if(it, it_end, equals(& eti));
|
||||
assert(it != m_map.end());
|
||||
return *it;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#if 0
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
basic_serializer_map::basic_serializer_map(bool & deleted) :
|
||||
m_deleted(deleted)
|
||||
{
|
||||
m_deleted = false;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_DECL(const basic_serializer *)
|
||||
basic_serializer_map::tfind(
|
||||
const boost::serialization::extended_type_info & eti
|
||||
) const {
|
||||
const basic_serializer_arg bs(eti);
|
||||
map_type::const_iterator it;
|
||||
boost::serialization::singleton<basic_serializer_map>::lease l;
|
||||
it = l->m_map.find(& bs);
|
||||
if(it == l->m_map.end())
|
||||
return NULL;
|
||||
return *it;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
|
||||
basic_serializer_map::~basic_serializer_map(){
|
||||
m_deleted = true;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_DECL(bool)
|
||||
basic_serializer_map::insert(const basic_serializer * bs){
|
||||
boost::serialization::singleton<basic_serializer_map>::lease l;
|
||||
return l->m_map.insert(bs).second;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_DECL(void)
|
||||
basic_serializer_map::erase(basic_serializer * bs){
|
||||
boost::serialization::singleton<basic_serializer_map>::lease l;
|
||||
l->m_map.erase(bs);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user