1 /*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
6 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
7 Software License, Version 1.0. (See accompanying file
8 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 =============================================================================*/
11 #if !defined(SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED)
12 #define SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED
16 #include <boost/wave/wave_config.hpp>
17 #include <boost/intrusive_ptr.hpp>
19 #if BOOST_WAVE_SERIALIZATION != 0
20 #include <boost/serialization/serialization.hpp>
21 #include <boost/serialization/map.hpp>
22 #include <boost/shared_ptr.hpp>
24 #include <boost/intrusive_ptr.hpp>
27 #include <boost/iterator/transform_iterator.hpp>
29 // this must occur after all of the includes and before any code appears
30 #ifdef BOOST_HAS_ABI_HEADERS
31 #include BOOST_ABI_PREFIX
34 ///////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////
41 // The symbol_table class is used for the storage of defined macros.
43 ///////////////////////////////////////////////////////////////////////////////
45 template <typename StringT, typename MacroDefT>
47 #if BOOST_WAVE_SERIALIZATION != 0
48 : public std::map<StringT, boost::shared_ptr<MacroDefT> >
50 : public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
53 #if BOOST_WAVE_SERIALIZATION != 0
54 typedef std::map<StringT, boost::shared_ptr<MacroDefT> > base_type;
56 typedef std::map<StringT, boost::intrusive_ptr<MacroDefT> > base_type;
58 typedef typename base_type::iterator iterator_type;
59 typedef typename base_type::const_iterator const_iterator_type;
61 symbol_table(long uid_ = 0)
64 #if BOOST_WAVE_SERIALIZATION != 0
66 friend class boost::serialization::access;
67 template<typename Archive>
68 void serialize(Archive &ar, const unsigned int version)
70 using namespace boost::serialization;
71 ar & make_nvp("symbol_table",
72 boost::serialization::base_object<base_type>(*this));
77 ///////////////////////////////////////////////////////////////////////////
79 // This is a special iterator allowing to iterate the names of all defined
82 ///////////////////////////////////////////////////////////////////////////
83 template <typename StringT1>
86 typedef StringT1 const& result_type;
88 template <typename First, typename Second>
89 StringT1 const& operator() (std::pair<First, Second> const& p) const
94 typedef get_first<StringT> unary_functor;
97 typedef transform_iterator<unary_functor, iterator_type>
99 typedef transform_iterator<unary_functor, const_iterator_type>
102 template <typename Iterator>
104 transform_iterator<unary_functor, Iterator> make_iterator(Iterator it)
106 return boost::make_transform_iterator<unary_functor>(it);
110 ///////////////////////////////////////////////////////////////////////////////
115 // the suffix header occurs after all of the code
116 #ifdef BOOST_HAS_ABI_HEADERS
117 #include BOOST_ABI_SUFFIX
120 #endif // !defined(SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED)