Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/wave/util/symbol_table.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Boost.Wave: A Standard compliant C++ preprocessor library | |
3 | |
4 http://www.boost.org/ | |
5 | |
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 =============================================================================*/ | |
10 | |
11 #if !defined(SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED) | |
12 #define SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED | |
13 | |
14 #include <map> | |
15 | |
16 #include <boost/wave/wave_config.hpp> | |
17 #include <boost/intrusive_ptr.hpp> | |
18 | |
19 #if BOOST_WAVE_SERIALIZATION != 0 | |
20 #include <boost/serialization/serialization.hpp> | |
21 #include <boost/serialization/map.hpp> | |
22 #include <boost/shared_ptr.hpp> | |
23 #else | |
24 #include <boost/intrusive_ptr.hpp> | |
25 #endif | |
26 | |
27 #include <boost/iterator/transform_iterator.hpp> | |
28 | |
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 | |
32 #endif | |
33 | |
34 /////////////////////////////////////////////////////////////////////////////// | |
35 namespace boost { | |
36 namespace wave { | |
37 namespace util { | |
38 | |
39 /////////////////////////////////////////////////////////////////////////////// | |
40 // | |
41 // The symbol_table class is used for the storage of defined macros. | |
42 // | |
43 /////////////////////////////////////////////////////////////////////////////// | |
44 | |
45 template <typename StringT, typename MacroDefT> | |
46 struct symbol_table | |
47 #if BOOST_WAVE_SERIALIZATION != 0 | |
48 : public std::map<StringT, boost::shared_ptr<MacroDefT> > | |
49 #else | |
50 : public std::map<StringT, boost::intrusive_ptr<MacroDefT> > | |
51 #endif | |
52 { | |
53 #if BOOST_WAVE_SERIALIZATION != 0 | |
54 typedef std::map<StringT, boost::shared_ptr<MacroDefT> > base_type; | |
55 #else | |
56 typedef std::map<StringT, boost::intrusive_ptr<MacroDefT> > base_type; | |
57 #endif | |
58 typedef typename base_type::iterator iterator_type; | |
59 typedef typename base_type::const_iterator const_iterator_type; | |
60 | |
61 symbol_table(long uid_ = 0) | |
62 {} | |
63 | |
64 #if BOOST_WAVE_SERIALIZATION != 0 | |
65 private: | |
66 friend class boost::serialization::access; | |
67 template<typename Archive> | |
68 void serialize(Archive &ar, const unsigned int version) | |
69 { | |
70 using namespace boost::serialization; | |
71 ar & make_nvp("symbol_table", | |
72 boost::serialization::base_object<base_type>(*this)); | |
73 } | |
74 #endif | |
75 | |
76 private: | |
77 /////////////////////////////////////////////////////////////////////////// | |
78 // | |
79 // This is a special iterator allowing to iterate the names of all defined | |
80 // macros. | |
81 // | |
82 /////////////////////////////////////////////////////////////////////////// | |
83 template <typename StringT1> | |
84 struct get_first | |
85 { | |
86 typedef StringT1 const& result_type; | |
87 | |
88 template <typename First, typename Second> | |
89 StringT1 const& operator() (std::pair<First, Second> const& p) const | |
90 { | |
91 return p.first; | |
92 } | |
93 }; | |
94 typedef get_first<StringT> unary_functor; | |
95 | |
96 public: | |
97 typedef transform_iterator<unary_functor, iterator_type> | |
98 name_iterator; | |
99 typedef transform_iterator<unary_functor, const_iterator_type> | |
100 const_name_iterator; | |
101 | |
102 template <typename Iterator> | |
103 static | |
104 transform_iterator<unary_functor, Iterator> make_iterator(Iterator it) | |
105 { | |
106 return boost::make_transform_iterator<unary_functor>(it); | |
107 } | |
108 }; | |
109 | |
110 /////////////////////////////////////////////////////////////////////////////// | |
111 } // namespace util | |
112 } // namespace wave | |
113 } // namespace boost | |
114 | |
115 // the suffix header occurs after all of the code | |
116 #ifdef BOOST_HAS_ABI_HEADERS | |
117 #include BOOST_ABI_SUFFIX | |
118 #endif | |
119 | |
120 #endif // !defined(SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED) |