]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp
pb_assoc: Delete.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / util / performance / assoc / multimap_common_type.hpp
1 // -*- C++ -*-
2
3 // Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 2, or (at your option) any later
9 // version.
10
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING. If not, write to
18 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19 // MA 02111-1307, USA.
20
21 // As a special exception, you may use this file as part of a free
22 // software library without restriction. Specifically, if other files
23 // instantiate templates or use macros or inline functions from this
24 // file, or you compile this file and link it with other files to
25 // produce an executable, this file does not by itself cause the
26 // resulting executable to be covered by the GNU General Public
27 // License. This exception does not however invalidate any other
28 // reasons why the executable file might be covered by the GNU General
29 // Public License.
30
31 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
32
33 // Permission to use, copy, modify, sell, and distribute this software
34 // is hereby granted without fee, provided that the above copyright
35 // notice appears in all copies, and that both that copyright notice
36 // and this permission notice appear in supporting documentation. None
37 // of the above authors, nor IBM Haifa Research Laboratories, make any
38 // representation about the suitability of this software for any
39 // purpose. It is provided "as is" without express or implied
40 // warranty.
41
42 /**
43 * @file multimap_common_type.hpp
44 * Contains types for a generic multimap_insert_test test.
45 */
46
47 #ifndef PB_DS_MULTIMAP_RANDOM_INT_INSERT_TEST_COMMON_TYPE_HPP
48 #define PB_DS_MULTIMAP_RANDOM_INT_INSERT_TEST_COMMON_TYPE_HPP
49
50 #include <hash_fn/string_hash_fn.hpp>
51 #include <common_type/assoc/common_type.hpp>
52
53 namespace pb_ds
54 {
55
56 namespace test
57 {
58
59 namespace detail
60 {
61
62 struct int_hash : public std::unary_function<
63 int,
64 size_t>
65 {
66 inline size_t
67 operator()(const int i) const
68 {
69 return (static_cast<size_t>(i));
70 }
71 };
72
73 template<typename Key, class Allocator = std::allocator<char> >
74 struct hash_set_tl_t
75 {
76 typedef
77 typename pb_ds::test::hash_common_types<
78 Key,
79 pb_ds::null_mapped_type,
80 int_hash,
81 std::equal_to<
82 Key>,
83 Allocator>::performance_min_tl
84 type;
85 };
86
87 template<typename Key, class Allocator = std::allocator<char> >
88 struct lu_set_tl_t
89 {
90 typedef
91 typename pb_ds::test::lu_common_types<
92 Key,
93 pb_ds::null_mapped_type,
94 std::equal_to<
95 Key>,
96 Allocator>::performance_min_tl
97 type;
98 };
99
100 template<typename Key,
101 class Sec_Tl,
102 class Allocator = std::allocator<
103 char> >
104 struct hash_mmap_tl_t
105 {
106 private:
107 typedef
108 typename pb_ds::detail::conditional_type<
109 pb_ds::detail::is_same<
110 int,
111 Key>::value,
112 int_hash,
113 string_hash_fn>::type
114 hash_fn_t;
115
116 template<typename Cntnr_T>
117 struct hash_mmap_transform
118 {
119 typedef
120 typename pb_ds::test::hash_common_types<
121 Key,
122 Cntnr_T,
123 hash_fn_t,
124 std::equal_to<
125 Key>,
126 Allocator>::performance_min_tl
127 type;
128 };
129
130 public:
131 typedef
132 typename pb_ds::detail::typelist_flatten<
133 typename pb_ds::detail::typelist_transform<
134 Sec_Tl,
135 hash_mmap_transform>::type>::type
136 type;
137 };
138
139 template<typename Key,
140 class Sec_Tl,
141 class Allocator = std::allocator<
142 char> >
143 struct tree_mmap_tl_t
144 {
145 private:
146 template<typename Cntnr_T>
147 struct tree_mmap_transform
148 {
149 typedef
150 typename pb_ds::test::tree_common_types<
151 Key,
152 Cntnr_T,
153 std::less<
154 Key>,
155 pb_ds::null_tree_node_update,
156 Allocator>::performance_min_tl
157 type;
158 };
159
160 public:
161 typedef
162 typename pb_ds::detail::typelist_flatten<
163 typename pb_ds::detail::typelist_transform<
164 Sec_Tl,
165 tree_mmap_transform>::type>::type
166 type;
167 };
168
169 template<typename Key, typename Mapped, class Allocator>
170 struct hash_hash_mmap_tl_t
171 {
172 private:
173 typedef typename hash_set_tl_t< Mapped, Allocator>::type sec_tl_t;
174
175 public:
176 typedef typename hash_mmap_tl_t< Key, sec_tl_t, Allocator>::type type;
177 };
178
179 template<typename Key, typename Mapped, class Allocator>
180 struct tree_hash_mmap_tl_t
181 {
182 private:
183 typedef typename hash_set_tl_t< Mapped, Allocator>::type sec_tl_t;
184
185 public:
186 typedef typename tree_mmap_tl_t< Key, sec_tl_t, Allocator>::type type;
187 };
188
189 template<typename Key, typename Mapped, class Allocator>
190 struct tree_lu_mmap_tl_t
191 {
192 private:
193 typedef typename lu_set_tl_t< Mapped, Allocator>::type sec_tl_t;
194
195 public:
196 typedef typename tree_mmap_tl_t< Key, sec_tl_t, Allocator>::type type;
197 };
198
199 template<typename Key, typename Mapped, class Allocator>
200 struct hash_lu_mmap_tl_t
201 {
202 private:
203 typedef typename lu_set_tl_t< Mapped, Allocator>::type sec_tl_t;
204
205 public:
206 typedef typename hash_mmap_tl_t< Key, sec_tl_t, Allocator>::type type;
207 };
208
209 } // namespace detail
210
211 template<typename Key, typename Mapped, class Allocator>
212 struct mmap_tl_t
213 {
214 private:
215 typedef
216 typename detail::hash_hash_mmap_tl_t<
217 Key,
218 Mapped,
219 Allocator>::type
220 hh_mmap_tl_t;
221
222 typedef
223 typename detail::hash_lu_mmap_tl_t<
224 Key,
225 Mapped,
226 Allocator>::type
227 hl_mmap_tl_t;
228
229 typedef
230 typename detail::tree_hash_mmap_tl_t<
231 Key,
232 Mapped,
233 Allocator>::type
234 th_mmap_tl_t;
235
236 typedef
237 typename detail::tree_lu_mmap_tl_t<
238 Key,
239 Mapped,
240 Allocator>::type
241 tl_mmap_tl_t;
242
243 public:
244 typedef
245 typename pb_ds::detail::typelist_append<
246 hl_mmap_tl_t,
247 typename pb_ds::detail::typelist_append<
248 hh_mmap_tl_t,
249 typename pb_ds::detail::typelist_append<
250 th_mmap_tl_t,
251 tl_mmap_tl_t>::type>::type>::type
252 type;
253 };
254
255 } // namespace test
256
257 } // namespace pb_ds
258
259 #endif // #ifndef PB_DS_MULTIMAP_RANDOM_INT_INSERT_TEST_COMMON_TYPE_HPP
260