Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/serialization/src/basic_serializer_map.cpp @ 20

Last change on this file since 20 was 12, checked in by landauf, 18 years ago

added boost

File size: 2.0 KB
Line 
1/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2// serializer_map.cpp:
3
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)
8
9//  See http://www.boost.org for updates, documentation, and revision history.
10
11#if (defined _MSC_VER) && (_MSC_VER == 1200)
12#  pragma warning (disable : 4786) // too long name, harmless warning
13#endif
14
15#include <set>
16
17#define BOOST_ARCHIVE_SOURCE
18#include <boost/archive/detail/basic_serializer.hpp>
19#include <boost/archive/detail/basic_serializer_map.hpp>
20
21namespace boost {
22    namespace serialization {
23        class extended_type_info;
24    }
25namespace archive {
26namespace detail {
27
28BOOST_ARCHIVE_DECL(bool) 
29type_info_pointer_compare::operator()(
30    const basic_serializer * lhs, const basic_serializer * rhs
31) const {
32    return *lhs < *rhs;
33}
34
35BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
36basic_serializer_map::basic_serializer_map(bool & deleted) :
37    m_deleted(deleted)
38{
39    m_deleted = false;
40}
41
42BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
43basic_serializer_map::~basic_serializer_map(){
44    m_deleted = true;
45}
46
47BOOST_ARCHIVE_DECL(bool) 
48basic_serializer_map::insert(const basic_serializer * bs){
49    return m_map.insert(bs).second;
50}
51
52BOOST_ARCHIVE_DECL(void) 
53basic_serializer_map::erase(basic_serializer * bs){
54    m_map.erase(bs);
55}
56
57class basic_serializer_arg : public basic_serializer {
58public:
59    basic_serializer_arg(const serialization::extended_type_info & eti) :
60        basic_serializer(eti)
61    {}
62};
63
64BOOST_ARCHIVE_DECL(const basic_serializer *) 
65basic_serializer_map::tfind(
66    const boost::serialization::extended_type_info & eti
67) const {
68    const basic_serializer_arg bs(eti);
69    map_type::const_iterator it;
70    it = m_map.find(& bs);
71    if(it == m_map.end())
72        return NULL;
73    return *it;
74}
75
76} // namespace detail
77} // namespace archive
78} // namespace boost
Note: See TracBrowser for help on using the repository browser.