1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org for updates, documentation, and revision history.
11 #if (defined _MSC_VER) && (_MSC_VER == 1200)
12 # pragma warning (disable : 4786) // too long name, harmless warning
18 #define BOOST_ARCHIVE_SOURCE
19 // include this to prevent linker errors when the
20 // same modules are marked export and import.
21 #define BOOST_SERIALIZATION_SOURCE
23 #include <boost/archive/archive_exception.hpp>
24 #include <boost/serialization/throw_exception.hpp>
26 #include <boost/archive/detail/basic_serializer.hpp>
27 #include <boost/archive/detail/basic_serializer_map.hpp>
30 namespace serialization {
31 class extended_type_info;
37 basic_serializer_map::type_info_pointer_compare::operator()(
38 const basic_serializer * lhs, const basic_serializer * rhs
43 BOOST_ARCHIVE_DECL(bool)
44 basic_serializer_map::insert(const basic_serializer * bs){
45 // attempt to insert serializer into it's map
46 // the following is commented out - rather than being just
47 // deleted as a reminder not to try this.
49 // const std::pair<map_type::iterator, bool> result =
52 // At first it seemed like a good idea. It enforced the
53 // idea that a type be exported from at most one code module
54 // (DLL or mainline). This would enforce a "one definition rule"
55 // across code modules. This seems a good idea to me.
56 // But it seems that it's just too hard for many users to implement.
58 // Ideally, I would like to make this exception a warning -
59 // but there isn't anyway to do that.
61 // if this fails, it's because it's been instantiated
62 // in multiple modules - DLLS - a recipe for problems.
64 // if(!result.second){
65 // boost::serialization::throw_exception(
67 // archive_exception::multiple_code_instantiation,
68 // bs->get_debug_info()
75 BOOST_ARCHIVE_DECL(void)
76 basic_serializer_map::erase(const basic_serializer * bs){
77 map_type::iterator it = m_map.begin();
78 map_type::iterator it_end = m_map.end();
81 // note item 9 from Effective STL !!! it++
87 // note: we can't do this since some of the eti records
88 // we're pointing to might be expired and the comparison
89 // won't work. Leave this as a reminder not to "optimize" this.
90 //it = m_map.find(bs);
91 //assert(it != m_map.end());
95 BOOST_ARCHIVE_DECL(const basic_serializer *)
96 basic_serializer_map::find(
97 const boost::serialization::extended_type_info & eti
99 const basic_serializer_arg bs(eti);
100 map_type::const_iterator it;
101 it = m_map.find(& bs);
102 if(it == m_map.end()){
109 } // namespace detail
110 } // namespace archive