container_base_dispatch.hpp revision 169691
1169691Skan// -*- C++ -*- 2169691Skan 3169691Skan// Copyright (C) 2005, 2006 Free Software Foundation, Inc. 4169691Skan// 5169691Skan// This file is part of the GNU ISO C++ Library. This library is free 6169691Skan// software; you can redistribute it and/or modify it under the terms 7169691Skan// of the GNU General Public License as published by the Free Software 8169691Skan// Foundation; either version 2, or (at your option) any later 9169691Skan// version. 10169691Skan 11169691Skan// This library is distributed in the hope that it will be useful, but 12169691Skan// WITHOUT ANY WARRANTY; without even the implied warranty of 13169691Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14169691Skan// General Public License for more details. 15169691Skan 16169691Skan// You should have received a copy of the GNU General Public License 17169691Skan// along with this library; see the file COPYING. If not, write to 18169691Skan// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, 19169691Skan// MA 02111-1307, USA. 20169691Skan 21169691Skan// As a special exception, you may use this file as part of a free 22169691Skan// software library without restriction. Specifically, if other files 23169691Skan// instantiate templates or use macros or inline functions from this 24169691Skan// file, or you compile this file and link it with other files to 25169691Skan// produce an executable, this file does not by itself cause the 26169691Skan// resulting executable to be covered by the GNU General Public 27169691Skan// License. This exception does not however invalidate any other 28169691Skan// reasons why the executable file might be covered by the GNU General 29169691Skan// Public License. 30169691Skan 31169691Skan// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 32169691Skan 33169691Skan// Permission to use, copy, modify, sell, and distribute this software 34169691Skan// is hereby granted without fee, provided that the above copyright 35169691Skan// notice appears in all copies, and that both that copyright notice 36169691Skan// and this permission notice appear in supporting documentation. None 37169691Skan// of the above authors, nor IBM Haifa Research Laboratories, make any 38169691Skan// representation about the suitability of this software for any 39169691Skan// purpose. It is provided "as is" without express or implied 40169691Skan// warranty. 41169691Skan 42169691Skan/** 43169691Skan * @file container_base_dispatch.hpp 44169691Skan * Contains an associative container dispatching base. 45169691Skan */ 46169691Skan 47169691Skan#ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP 48169691Skan#define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP 49169691Skan 50169691Skan#include <ext/typelist.h> 51169691Skan 52169691Skan#define PB_DS_DATA_TRUE_INDICATOR 53169691Skan#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp> 54169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 55169691Skan 56169691Skan#define PB_DS_DATA_FALSE_INDICATOR 57169691Skan#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp> 58169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 59169691Skan 60169691Skan#define PB_DS_DATA_TRUE_INDICATOR 61169691Skan#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp> 62169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 63169691Skan 64169691Skan#define PB_DS_DATA_FALSE_INDICATOR 65169691Skan#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp> 66169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 67169691Skan 68169691Skan#define PB_DS_DATA_TRUE_INDICATOR 69169691Skan#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp> 70169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 71169691Skan 72169691Skan#define PB_DS_DATA_FALSE_INDICATOR 73169691Skan#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp> 74169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 75169691Skan 76169691Skan#define PB_DS_DATA_TRUE_INDICATOR 77169691Skan#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp> 78169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 79169691Skan 80169691Skan#define PB_DS_DATA_FALSE_INDICATOR 81169691Skan#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp> 82169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 83169691Skan 84169691Skan#define PB_DS_DATA_TRUE_INDICATOR 85169691Skan#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp> 86169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 87169691Skan 88169691Skan#define PB_DS_DATA_FALSE_INDICATOR 89169691Skan#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp> 90169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 91169691Skan 92169691Skan#define PB_DS_DATA_TRUE_INDICATOR 93169691Skan#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp> 94169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 95169691Skan 96169691Skan#define PB_DS_DATA_FALSE_INDICATOR 97169691Skan#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp> 98169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 99169691Skan 100169691Skan#define PB_DS_DATA_TRUE_INDICATOR 101169691Skan#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp> 102169691Skan#undef PB_DS_DATA_TRUE_INDICATOR 103169691Skan 104169691Skan#define PB_DS_DATA_FALSE_INDICATOR 105169691Skan#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp> 106169691Skan#undef PB_DS_DATA_FALSE_INDICATOR 107169691Skan 108169691Skannamespace pb_ds 109169691Skan{ 110169691Skannamespace detail 111169691Skan{ 112169691Skan // Primary template. 113169691Skan template<typename Key, typename Mapped, typename Data_Structure_Taq, 114169691Skan typename Policy_Tl, typename Alloc> 115169691Skan struct container_base_dispatch; 116169691Skan 117169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 118169691Skan struct container_base_dispatch<Key, Mapped, list_update_tag, 119169691Skan Policy_Tl, Alloc> 120169691Skan { 121169691Skan private: 122169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 123169691Skan typedef typename at0::type at0t; 124169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 125169691Skan typedef typename at1::type at1t; 126169691Skan 127169691Skan public: 128169691Skan typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t> type; 129169691Skan }; 130169691Skan 131169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 132169691Skan struct container_base_dispatch<Key, null_mapped_type, list_update_tag, 133169691Skan Policy_Tl, Alloc> 134169691Skan { 135169691Skan private: 136169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 137169691Skan typedef typename at0::type at0t; 138169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 139169691Skan typedef typename at1::type at1t; 140169691Skan 141169691Skan public: 142169691Skan typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type; 143169691Skan }; 144169691Skan 145169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 146169691Skan struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc> 147169691Skan { 148169691Skan private: 149169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 150169691Skan typedef typename at1::type at1t; 151169691Skan 152169691Skan public: 153169691Skan typedef pat_trie_data_<Key, Mapped, at1t, Alloc> type; 154169691Skan }; 155169691Skan 156169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 157169691Skan struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag, 158169691Skan Policy_Tl, Alloc> 159169691Skan { 160169691Skan private: 161169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 162169691Skan typedef typename at1::type at1t; 163169691Skan 164169691Skan public: 165169691Skan typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type; 166169691Skan }; 167169691Skan 168169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 169169691Skan struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc> 170169691Skan { 171169691Skan private: 172169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 173169691Skan typedef typename at0::type at0t; 174169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 175169691Skan typedef typename at1::type at1t; 176169691Skan 177169691Skan public: 178169691Skan typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc> type; 179169691Skan }; 180169691Skan 181169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 182169691Skan struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag, 183169691Skan Policy_Tl, Alloc> 184169691Skan { 185169691Skan private: 186169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 187169691Skan typedef typename at0::type at0t; 188169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 189169691Skan typedef typename at1::type at1t; 190169691Skan 191169691Skan public: 192169691Skan typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type; 193169691Skan }; 194169691Skan 195169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 196169691Skan struct container_base_dispatch<Key, Mapped, splay_tree_tag, 197169691Skan Policy_Tl, Alloc> 198169691Skan { 199169691Skan private: 200169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 201169691Skan typedef typename at0::type at0t; 202169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 203169691Skan typedef typename at1::type at1t; 204169691Skan 205169691Skan public: 206169691Skan typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc> type; 207169691Skan }; 208169691Skan 209169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 210169691Skan struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag, 211169691Skan Policy_Tl, Alloc> 212169691Skan { 213169691Skan private: 214169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 215169691Skan typedef typename at0::type at0t; 216169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 217169691Skan typedef typename at1::type at1t; 218169691Skan 219169691Skan public: 220169691Skan typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type; 221169691Skan }; 222169691Skan 223169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 224169691Skan struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc> 225169691Skan { 226169691Skan private: 227169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 228169691Skan typedef typename at0::type at0t; 229169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 230169691Skan typedef typename at1::type at1t; 231169691Skan 232169691Skan public: 233169691Skan typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc> type; 234169691Skan }; 235169691Skan 236169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 237169691Skan struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag, 238169691Skan Policy_Tl, Alloc> 239169691Skan { 240169691Skan private: 241169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 242169691Skan typedef typename at0::type at0t; 243169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 244169691Skan typedef typename at1::type at1t; 245169691Skan 246169691Skan public: 247169691Skan typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type; 248169691Skan }; 249169691Skan 250169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 251169691Skan struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc> 252169691Skan { 253169691Skan private: 254169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 255169691Skan typedef typename at0::type at0t; 256169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 257169691Skan typedef typename at1::type at1t; 258169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; 259169691Skan typedef typename at2::type at2t; 260169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; 261169691Skan typedef typename at3::type at3t; 262169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; 263169691Skan typedef typename at4::type at4t; 264169691Skan 265169691Skan public: 266169691Skan typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value, 267169691Skan at4t, at2t> type; 268169691Skan }; 269169691Skan 270169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 271169691Skan struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag, 272169691Skan Policy_Tl, Alloc> 273169691Skan { 274169691Skan private: 275169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 276169691Skan typedef typename at0::type at0t; 277169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 278169691Skan typedef typename at1::type at1t; 279169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; 280169691Skan typedef typename at2::type at2t; 281169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; 282169691Skan typedef typename at3::type at3t; 283169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; 284169691Skan typedef typename at4::type at4t; 285169691Skan 286169691Skan public: 287169691Skan typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc, 288169691Skan at3t::value, at4t, at2t> type; 289169691Skan }; 290169691Skan 291169691Skan template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc> 292169691Skan struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc> 293169691Skan { 294169691Skan private: 295169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 296169691Skan typedef typename at0::type at0t; 297169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 298169691Skan typedef typename at1::type at1t; 299169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; 300169691Skan typedef typename at2::type at2t; 301169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; 302169691Skan typedef typename at3::type at3t; 303169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; 304169691Skan typedef typename at4::type at4t; 305169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5; 306169691Skan typedef typename at5::type at5t; 307169691Skan 308169691Skan public: 309169691Skan typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value, 310169691Skan at4t, at5t, at2t> type; 311169691Skan }; 312169691Skan 313169691Skan template<typename Key, typename Policy_Tl, typename Alloc> 314169691Skan struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag, 315169691Skan Policy_Tl, Alloc> 316169691Skan { 317169691Skan private: 318169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0; 319169691Skan typedef typename at0::type at0t; 320169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1; 321169691Skan typedef typename at1::type at1t; 322169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2; 323169691Skan typedef typename at2::type at2t; 324169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3; 325169691Skan typedef typename at3::type at3t; 326169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4; 327169691Skan typedef typename at4::type at4t; 328169691Skan typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5; 329169691Skan typedef typename at5::type at5t; 330169691Skan 331169691Skan public: 332169691Skan typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc, 333169691Skan at3t::value, at4t, at5t, at2t> type; 334169691Skan }; 335169691Skan} // namespace detail 336169691Skan} // namespace pb_ds 337169691Skan 338169691Skan#endif 339