3 // Copyright (C) 2005, 2006 Free Software Foundation, Inc.
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
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.
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.
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
31 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
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
43 * @file container_base_dispatch.hpp
44 * Contains an associative container dispatching base.
47 #ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
48 #define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
50 #include <ext/typelist.h>
52 #define PB_DS_DATA_TRUE_INDICATOR
53 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
54 #undef PB_DS_DATA_TRUE_INDICATOR
56 #define PB_DS_DATA_FALSE_INDICATOR
57 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
58 #undef PB_DS_DATA_FALSE_INDICATOR
60 #define PB_DS_DATA_TRUE_INDICATOR
61 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
62 #undef PB_DS_DATA_TRUE_INDICATOR
64 #define PB_DS_DATA_FALSE_INDICATOR
65 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
66 #undef PB_DS_DATA_FALSE_INDICATOR
68 #define PB_DS_DATA_TRUE_INDICATOR
69 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
70 #undef PB_DS_DATA_TRUE_INDICATOR
72 #define PB_DS_DATA_FALSE_INDICATOR
73 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
74 #undef PB_DS_DATA_FALSE_INDICATOR
76 #define PB_DS_DATA_TRUE_INDICATOR
77 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
78 #undef PB_DS_DATA_TRUE_INDICATOR
80 #define PB_DS_DATA_FALSE_INDICATOR
81 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
82 #undef PB_DS_DATA_FALSE_INDICATOR
84 #define PB_DS_DATA_TRUE_INDICATOR
85 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
86 #undef PB_DS_DATA_TRUE_INDICATOR
88 #define PB_DS_DATA_FALSE_INDICATOR
89 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
90 #undef PB_DS_DATA_FALSE_INDICATOR
92 #define PB_DS_DATA_TRUE_INDICATOR
93 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
94 #undef PB_DS_DATA_TRUE_INDICATOR
96 #define PB_DS_DATA_FALSE_INDICATOR
97 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
98 #undef PB_DS_DATA_FALSE_INDICATOR
100 #define PB_DS_DATA_TRUE_INDICATOR
101 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
102 #undef PB_DS_DATA_TRUE_INDICATOR
104 #define PB_DS_DATA_FALSE_INDICATOR
105 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
106 #undef PB_DS_DATA_FALSE_INDICATOR
113 template<typename Key, typename Mapped, typename Data_Structure_Taq,
114 typename Policy_Tl, typename Alloc>
115 struct container_base_dispatch;
117 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
118 struct container_base_dispatch<Key, Mapped, list_update_tag,
122 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
123 typedef typename at0::type at0t;
124 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
125 typedef typename at1::type at1t;
128 typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t> type;
131 template<typename Key, typename Policy_Tl, typename Alloc>
132 struct container_base_dispatch<Key, null_mapped_type, list_update_tag,
136 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
137 typedef typename at0::type at0t;
138 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
139 typedef typename at1::type at1t;
142 typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type;
145 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
146 struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc>
149 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
150 typedef typename at1::type at1t;
153 typedef pat_trie_data_<Key, Mapped, at1t, Alloc> type;
156 template<typename Key, typename Policy_Tl, typename Alloc>
157 struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag,
161 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
162 typedef typename at1::type at1t;
165 typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type;
168 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
169 struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc>
172 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
173 typedef typename at0::type at0t;
174 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
175 typedef typename at1::type at1t;
178 typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
181 template<typename Key, typename Policy_Tl, typename Alloc>
182 struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag,
186 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
187 typedef typename at0::type at0t;
188 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
189 typedef typename at1::type at1t;
192 typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
195 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
196 struct container_base_dispatch<Key, Mapped, splay_tree_tag,
200 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
201 typedef typename at0::type at0t;
202 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
203 typedef typename at1::type at1t;
206 typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
209 template<typename Key, typename Policy_Tl, typename Alloc>
210 struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag,
214 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
215 typedef typename at0::type at0t;
216 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
217 typedef typename at1::type at1t;
220 typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
223 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
224 struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc>
227 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
228 typedef typename at0::type at0t;
229 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
230 typedef typename at1::type at1t;
233 typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
236 template<typename Key, typename Policy_Tl, typename Alloc>
237 struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag,
241 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
242 typedef typename at0::type at0t;
243 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
244 typedef typename at1::type at1t;
247 typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
250 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
251 struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc>
254 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
255 typedef typename at0::type at0t;
256 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
257 typedef typename at1::type at1t;
258 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
259 typedef typename at2::type at2t;
260 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
261 typedef typename at3::type at3t;
262 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
263 typedef typename at4::type at4t;
266 typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
270 template<typename Key, typename Policy_Tl, typename Alloc>
271 struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag,
275 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
276 typedef typename at0::type at0t;
277 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
278 typedef typename at1::type at1t;
279 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
280 typedef typename at2::type at2t;
281 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
282 typedef typename at3::type at3t;
283 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
284 typedef typename at4::type at4t;
287 typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
288 at3t::value, at4t, at2t> type;
291 template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
292 struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc>
295 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
296 typedef typename at0::type at0t;
297 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
298 typedef typename at1::type at1t;
299 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
300 typedef typename at2::type at2t;
301 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
302 typedef typename at3::type at3t;
303 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
304 typedef typename at4::type at4t;
305 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5;
306 typedef typename at5::type at5t;
309 typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
310 at4t, at5t, at2t> type;
313 template<typename Key, typename Policy_Tl, typename Alloc>
314 struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag,
318 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
319 typedef typename at0::type at0t;
320 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
321 typedef typename at1::type at1t;
322 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
323 typedef typename at2::type at2t;
324 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
325 typedef typename at3::type at3t;
326 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
327 typedef typename at4::type at4t;
328 typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5;
329 typedef typename at5::type at5t;
332 typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
333 at3t::value, at4t, at5t, at2t> type;
335 } // namespace detail