1// -*- C++ -*-
2
3// Copyright (C) 2005 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
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING.  If not, write to the Free
18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19// USA.
20
21// As a special exception, you may use this file as part of a free software
22// library without restriction.  Specifically, if other files instantiate
23// templates or use macros or inline functions from this file, or you compile
24// this file and link it with other files to produce an executable, this
25// file does not by itself cause the resulting executable to be covered by
26// the GNU General Public License.  This exception does not however
27// invalidate any other reasons why the executable file might be covered by
28// the GNU General Public License.
29
30// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
31
32// Permission to use, copy, modify, sell, and distribute this software
33// is hereby granted without fee, provided that the above copyright
34// notice appears in all copies, and that both that copyright notice and
35// this permission notice appear in supporting documentation. None of
36// the above authors, nor IBM Haifa Research Laboratories, make any
37// representation about the suitability of this software for any
38// purpose. It is provided "as is" without express or implied warranty.
39
40/**
41 * @file assoc_cntnr_base.hpp
42 * Contains an associative container dispatching base.
43 */
44
45#ifndef ASSOC_CNTNR_BASE_HPP
46#define ASSOC_CNTNR_BASE_HPP
47
48#include <ext/pb_assoc/detail/typelist.hpp>
49
50#define PB_ASSOC_DATA_TRUE_INDICATOR
51#include <ext/pb_assoc/detail/lu_map_/lu_map_.hpp>
52#undef PB_ASSOC_DATA_TRUE_INDICATOR
53
54#define PB_ASSOC_DATA_FALSE_INDICATOR
55#include <ext/pb_assoc/detail/lu_map_/lu_map_.hpp>
56#undef PB_ASSOC_DATA_FALSE_INDICATOR
57
58#define PB_ASSOC_DATA_TRUE_INDICATOR
59#include <ext/pb_assoc/detail/rb_tree_map_/rb_tree_.hpp>
60#undef PB_ASSOC_DATA_TRUE_INDICATOR
61
62#define PB_ASSOC_DATA_FALSE_INDICATOR
63#include <ext/pb_assoc/detail/rb_tree_map_/rb_tree_.hpp>
64#undef PB_ASSOC_DATA_FALSE_INDICATOR
65
66#define PB_ASSOC_DATA_TRUE_INDICATOR
67#include <ext/pb_assoc/detail/splay_tree_/splay_tree_.hpp>
68#undef PB_ASSOC_DATA_TRUE_INDICATOR
69
70#define PB_ASSOC_DATA_FALSE_INDICATOR
71#include <ext/pb_assoc/detail/splay_tree_/splay_tree_.hpp>
72#undef PB_ASSOC_DATA_FALSE_INDICATOR
73
74#define PB_ASSOC_DATA_TRUE_INDICATOR
75#include <ext/pb_assoc/detail/ov_tree_map_/ov_tree_map_.hpp>
76#undef PB_ASSOC_DATA_TRUE_INDICATOR
77
78#define PB_ASSOC_DATA_FALSE_INDICATOR
79#include <ext/pb_assoc/detail/ov_tree_map_/ov_tree_map_.hpp>
80#undef PB_ASSOC_DATA_FALSE_INDICATOR
81
82#define PB_ASSOC_DATA_TRUE_INDICATOR
83#include <ext/pb_assoc/detail/cc_ht_map_/cc_ht_map_.hpp>
84#undef PB_ASSOC_DATA_TRUE_INDICATOR
85
86#define PB_ASSOC_DATA_FALSE_INDICATOR
87#include <ext/pb_assoc/detail/cc_ht_map_/cc_ht_map_.hpp>
88#undef PB_ASSOC_DATA_FALSE_INDICATOR
89
90#define PB_ASSOC_DATA_TRUE_INDICATOR
91#include <ext/pb_assoc/detail/gp_ht_map_/gp_ht_map_.hpp>
92#undef PB_ASSOC_DATA_TRUE_INDICATOR
93
94#define PB_ASSOC_DATA_FALSE_INDICATOR
95#include <ext/pb_assoc/detail/gp_ht_map_/gp_ht_map_.hpp>
96#undef PB_ASSOC_DATA_FALSE_INDICATOR
97
98namespace pb_assoc
99{
100
101  namespace detail
102  {
103
104    template<typename Key,
105	     typename Data,
106	     class Data_Structure_Taq,
107	     class Policy_Tl,
108	     class Allocator>
109    struct assoc_cntnr_base;
110
111    template<typename Key, typename Data, class Policy_Tl, class Allocator>
112    struct assoc_cntnr_base<
113      Key,
114      Data,
115      lu_ds_tag,
116      Policy_Tl,
117      Allocator>
118    {
119      typedef
120      lu_map_data_<
121	Key,
122	Data,
123	typename typelist_at_index<Policy_Tl, 0>::type,
124	Allocator,
125	typename typelist_at_index<Policy_Tl, 1>::type>
126      type;
127    };
128
129    template<typename Key, class Policy_Tl, class Allocator>
130    struct assoc_cntnr_base<
131      Key,
132      null_data_type,
133      lu_ds_tag,
134      Policy_Tl,
135      Allocator>
136    {
137      typedef
138      lu_map_no_data_<
139	Key,
140	null_data_type,
141	typename typelist_at_index<Policy_Tl, 0>::type,
142	Allocator,
143	typename typelist_at_index<Policy_Tl, 1>::type>
144      type;
145    };
146
147    template<typename Key, typename Data, class Policy_Tl, class Allocator>
148    struct assoc_cntnr_base<
149      Key,
150      Data,
151      rb_tree_ds_tag,
152      Policy_Tl,
153      Allocator>
154    {
155      typedef
156      rb_tree_data_<
157	Key,
158	Data,
159	typename typelist_at_index<Policy_Tl, 0>::type,
160	Allocator,
161	typename typelist_at_index<Policy_Tl, 1>::type>
162      type;
163    };
164
165    template<typename Key, class Policy_Tl, class Allocator>
166    struct assoc_cntnr_base<
167      Key,
168      null_data_type,
169      rb_tree_ds_tag,
170      Policy_Tl,
171      Allocator>
172    {
173      typedef
174      rb_tree_no_data_<
175	Key,
176	null_data_type,
177	typename typelist_at_index<Policy_Tl, 0>::type,
178	Allocator,
179	typename typelist_at_index<Policy_Tl, 1>::type>
180      type;
181    };
182
183    template<typename Key, typename Data, class Policy_Tl, class Allocator>
184    struct assoc_cntnr_base<
185      Key,
186      Data,
187      splay_tree_ds_tag,
188      Policy_Tl,
189      Allocator>
190
191    {
192      typedef
193      splay_tree_data_<
194	Key,
195	Data,
196	typename typelist_at_index<Policy_Tl, 0>::type,
197	Allocator,
198	typename typelist_at_index<Policy_Tl, 1>::type>
199      type;
200    };
201
202    template<typename Key, class Policy_Tl, class Allocator>
203    struct assoc_cntnr_base<
204      Key,
205      null_data_type,
206      splay_tree_ds_tag,
207      Policy_Tl,
208      Allocator>
209    {
210      typedef
211      splay_tree_no_data_<
212	Key,
213	null_data_type,
214	typename typelist_at_index<Policy_Tl, 0>::type,
215	Allocator,
216	typename typelist_at_index<Policy_Tl, 1>::type>
217      type;
218    };
219
220    template<typename Key, typename Data, class Policy_Tl, class Allocator>
221    struct assoc_cntnr_base<
222      Key,
223      Data,
224      ov_tree_ds_tag,
225      Policy_Tl,
226      Allocator>
227    {
228      typedef
229      ov_tree_data_<
230	Key,
231	Data,
232	typename typelist_at_index<Policy_Tl, 0>::type,
233	Allocator,
234	typename typelist_at_index<Policy_Tl, 1>::type>
235      type;
236    };
237
238    template<typename Key, class Policy_Tl, class Allocator>
239    struct assoc_cntnr_base<
240      Key,
241      null_data_type,
242      ov_tree_ds_tag,
243      Policy_Tl,
244      Allocator>
245    {
246      typedef
247      ov_tree_no_data_<
248	Key,
249	null_data_type,
250	typename typelist_at_index<Policy_Tl, 0>::type,
251	Allocator,
252	typename typelist_at_index<Policy_Tl, 1>::type>
253      type;
254    };
255
256    template<typename Key, typename Data, class Policy_Tl, class Allocator>
257    struct assoc_cntnr_base<
258      Key,
259      Data,
260      cc_hash_ds_tag,
261      Policy_Tl,
262      Allocator>
263    {
264      typedef
265      cc_ht_map_data_<
266	Key,
267	Data,
268	typename typelist_at_index<Policy_Tl, 0>::type,
269	typename typelist_at_index<Policy_Tl, 1>::type,
270	Allocator,
271	typelist_at_index<Policy_Tl, 3>::type::value,
272	typename typelist_at_index<Policy_Tl, 4>::type,
273	typename typelist_at_index<Policy_Tl, 2>::type>
274      type;
275    };
276
277    template<typename Key, class Policy_Tl, class Allocator>
278    struct assoc_cntnr_base<
279      Key,
280      null_data_type,
281      cc_hash_ds_tag,
282      Policy_Tl,
283      Allocator>
284    {
285      typedef
286      cc_ht_map_no_data_<
287	Key,
288	null_data_type,
289	typename typelist_at_index<Policy_Tl, 0>::type,
290	typename typelist_at_index<Policy_Tl, 1>::type,
291	Allocator,
292	typelist_at_index<Policy_Tl, 3>::type::value,
293	typename typelist_at_index<Policy_Tl, 4>::type,
294	typename typelist_at_index<Policy_Tl, 2>::type>
295      type;
296    };
297
298    template<typename Key, typename Data, class Policy_Tl, class Allocator>
299    struct assoc_cntnr_base<
300      Key,
301      Data,
302      gp_hash_ds_tag,
303      Policy_Tl,
304      Allocator>
305    {
306      typedef
307      gp_ht_map_data_<
308	Key,
309	Data,
310	typename typelist_at_index<Policy_Tl, 0>::type,
311	typename typelist_at_index<Policy_Tl, 1>::type,
312	Allocator,
313	typelist_at_index<Policy_Tl, 3>::type::value,
314	typename typelist_at_index<Policy_Tl, 4>::type,
315	typename typelist_at_index<Policy_Tl, 5>::type,
316	typename typelist_at_index<Policy_Tl, 2>::type>
317      type;
318    };
319
320    template<typename Key, class Policy_Tl, class Allocator>
321    struct assoc_cntnr_base<
322      Key,
323      null_data_type,
324      gp_hash_ds_tag,
325      Policy_Tl,
326      Allocator>
327    {
328      typedef
329      gp_ht_map_no_data_<
330	Key,
331	null_data_type,
332	typename typelist_at_index<Policy_Tl, 0>::type,
333	typename typelist_at_index<Policy_Tl, 1>::type,
334	Allocator,
335	typelist_at_index<Policy_Tl, 3>::type::value,
336	typename typelist_at_index<Policy_Tl, 4>::type,
337	typename typelist_at_index<Policy_Tl, 5>::type,
338	typename typelist_at_index<Policy_Tl, 2>::type>
339      type;
340    };
341
342  } // namespace detail
343
344} // namespace pb_assoc
345
346#endif // #ifndef ASSOC_CNTNR_BASE_HPP
347