source: NonGTP/Boost/boost/serialization/extended_type_info.hpp @ 857

Revision 857, 3.1 KB checked in by igarcia, 18 years ago (diff)
Line 
1#ifndef BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP
2#define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER) && (_MSC_VER >= 1020)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// extended_type_info.hpp: interface for portable version of type_info
11
12// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17//  See http://www.boost.org for updates, documentation, and revision history.
18
19// for now, extended type info is part of the serialization libraries
20// this could change in the future.
21#include <boost/config.hpp>
22#include <boost/noncopyable.hpp>
23#include <boost/serialization/config.hpp>
24
25#include <boost/config/abi_prefix.hpp> // must be the last header
26#ifdef BOOST_MSVC
27#  pragma warning(push)
28#  pragma warning(disable : 4251 4231 4660 4275)
29#endif
30
31#define BOOST_SERIALIZATION_MAX_KEY_SIZE 128
32
33namespace boost {
34namespace serialization {
35
36class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info :
37    private boost::noncopyable
38{
39private:
40    virtual bool
41    less_than(const extended_type_info &rhs) const = 0;
42    int type_info_key_cmp(const extended_type_info & rhs) const;
43   
44    // used to uniquely identify the type of class derived from this one
45    // so that different derivations of this class can be simultaneously
46    // included in implementation of sets and maps.
47    const char * m_type_info_key;
48    // flag to indicate wheter its been registered by type;
49    bool m_self_registered;
50    // flag to indicate wheter its been registered by type;
51    bool m_key_registered;
52    // flag indicating that no virtual function should be called here
53    // this is necessary since it seems that at least one compiler (borland
54    // and one version of gcc call less_than above when erasing even
55    // when given an iterator argument.
56    bool m_is_destructing;
57protected:
58    const char * m_key;
59    extended_type_info(const char * type_info_key);
60    // account for bogus gcc warning
61    #if defined(__GNUC__)
62    virtual
63    #endif
64    ~extended_type_info();
65public:
66    void self_register();
67    void key_register(const char *key);
68    bool is_destructing() const {
69        return m_is_destructing;
70    }
71    bool operator<(const extended_type_info &rhs) const;
72    bool operator==(const extended_type_info &rhs) const {
73        return this == & rhs;
74    }
75    bool operator!=(const extended_type_info &rhs) const {
76        return this != & rhs;
77    }
78    const char * get_key() const {
79        return m_key;
80    }
81    static const extended_type_info * find(const char *key);
82    static const extended_type_info * find(const extended_type_info * t);
83};
84
85} // namespace serialization
86} // namespace boost
87
88#ifdef BOOST_MSVC
89#pragma warning(pop)
90#endif
91#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
92
93#endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP
94
Note: See TracBrowser for help on using the repository browser.