# container_base_dispatch.hpp

Go to the documentation of this file.

    00001 // -*- C++ -*-
    00002
    00003 // Copyright (C) 2005, 2006 Free Software Foundation, Inc.
    00004 //
    00005 // This file is part of the GNU ISO C++ Library.  This library is free
    00006 // software; you can redistribute it and/or modify it under the terms
    00007 // of the GNU General Public License as published by the Free Software
    00008 // Foundation; either version 2, or (at your option) any later
    00009 // version.
    00010
    00011 // This library is distributed in the hope that it will be useful, but
    00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014 // General Public License for more details.
    00015
    00016 // You should have received a copy of the GNU General Public License
    00017 // along with this library; see the file COPYING.  If not, write to
    00018 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
    00019 // MA 02111-1307, USA.
    00020
    00021 // As a special exception, you may use this file as part of a free
    00022 // software library without restriction.  Specifically, if other files
    00023 // instantiate templates or use macros or inline functions from this
    00024 // file, or you compile this file and link it with other files to
    00025 // produce an executable, this file does not by itself cause the
    00026 // resulting executable to be covered by the GNU General Public
    00027 // License.  This exception does not however invalidate any other
    00028 // reasons why the executable file might be covered by the GNU General
    00029 // Public License.
    00030
    00031 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
    00032
    00033 // Permission to use, copy, modify, sell, and distribute this software
    00034 // is hereby granted without fee, provided that the above copyright
    00035 // notice appears in all copies, and that both that copyright notice
    00036 // and this permission notice appear in supporting documentation. None
    00037 // of the above authors, nor IBM Haifa Research Laboratories, make any
    00038 // representation about the suitability of this software for any
    00039 // purpose. It is provided "as is" without express or implied
    00040 // warranty.
    00041
    00042 /**
    00043  * @file container_base_dispatch.hpp
    00044  * Contains an associative container dispatching base.
    00045  */
    00046
    00047 #ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
    00048 #define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
    00049
    00050 #include <ext/typelist.h>
    00051
    00052 #define PB_DS_DATA_TRUE_INDICATOR
    00053 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
    00054 #undef PB_DS_DATA_TRUE_INDICATOR
    00055
    00056 #define PB_DS_DATA_FALSE_INDICATOR
    00057 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
    00058 #undef PB_DS_DATA_FALSE_INDICATOR
    00059
    00060 #define PB_DS_DATA_TRUE_INDICATOR
    00061 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
    00062 #undef PB_DS_DATA_TRUE_INDICATOR
    00063
    00064 #define PB_DS_DATA_FALSE_INDICATOR
    00065 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
    00066 #undef PB_DS_DATA_FALSE_INDICATOR
    00067
    00068 #define PB_DS_DATA_TRUE_INDICATOR
    00069 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
    00070 #undef PB_DS_DATA_TRUE_INDICATOR
    00071
    00072 #define PB_DS_DATA_FALSE_INDICATOR
    00073 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
    00074 #undef PB_DS_DATA_FALSE_INDICATOR
    00075
    00076 #define PB_DS_DATA_TRUE_INDICATOR
    00077 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
    00078 #undef PB_DS_DATA_TRUE_INDICATOR
    00079
    00080 #define PB_DS_DATA_FALSE_INDICATOR
    00081 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
    00082 #undef PB_DS_DATA_FALSE_INDICATOR
    00083
    00084 #define PB_DS_DATA_TRUE_INDICATOR
    00085 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
    00086 #undef PB_DS_DATA_TRUE_INDICATOR
    00087
    00088 #define PB_DS_DATA_FALSE_INDICATOR
    00089 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
    00090 #undef PB_DS_DATA_FALSE_INDICATOR
    00091
    00092 #define PB_DS_DATA_TRUE_INDICATOR
    00093 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
    00094 #undef PB_DS_DATA_TRUE_INDICATOR
    00095
    00096 #define PB_DS_DATA_FALSE_INDICATOR
    00097 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
    00098 #undef PB_DS_DATA_FALSE_INDICATOR
    00099
    00100 #define PB_DS_DATA_TRUE_INDICATOR
    00101 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
    00102 #undef PB_DS_DATA_TRUE_INDICATOR
    00103
    00104 #define PB_DS_DATA_FALSE_INDICATOR
    00105 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
    00106 #undef PB_DS_DATA_FALSE_INDICATOR
    00107
    00108 namespace __gnu_pbds
    00109 {
    00110 namespace detail
    00111 {
    00112   // Primary template.
    00113   template<typename Key, typename Mapped, typename Data_Structure_Taq,
    00114        typename Policy_Tl, typename Alloc>
    00115     struct container_base_dispatch;
    00116
    00117   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00118     struct container_base_dispatch<Key, Mapped, list_update_tag,
    00119                    Policy_Tl, Alloc>
    00120     {
    00121     private:
    00122       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00123       typedef typename at0::type                    at0t;
    00124       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00125       typedef typename at1::type                    at1t;
    00126
    00127     public:
    00128       typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t>  type;
    00129     };
    00130
    00131   template<typename Key, typename Policy_Tl, typename Alloc>
    00132     struct container_base_dispatch<Key, null_mapped_type, list_update_tag,
    00133                    Policy_Tl, Alloc>
    00134     {
    00135     private:
    00136       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00137       typedef typename at0::type                    at0t;
    00138       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00139       typedef typename at1::type                    at1t;
    00140
    00141     public:
    00142       typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type;
    00143     };
    00144
    00145   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00146     struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc>
    00147     {
    00148     private:
    00149       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00150       typedef typename at1::type                    at1t;
    00151
    00152     public:
    00153       typedef pat_trie_data_<Key, Mapped, at1t, Alloc>      type;
    00154     };
    00155
    00156   template<typename Key, typename Policy_Tl, typename Alloc>
    00157     struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag,
    00158                    Policy_Tl, Alloc>
    00159     {
    00160     private:
    00161       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00162       typedef typename at1::type                    at1t;
    00163
    00164     public:
    00165       typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type;
    00166     };
    00167
    00168   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00169     struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc>
    00170     {
    00171     private:
    00172       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00173       typedef typename at0::type                    at0t;
    00174       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00175       typedef typename at1::type                    at1t;
    00176
    00177     public:
    00178       typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc>     type;
    00179     };
    00180
    00181   template<typename Key, typename Policy_Tl, typename Alloc>
    00182     struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag,
    00183                    Policy_Tl, Alloc>
    00184     {
    00185     private:
    00186       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00187       typedef typename at0::type                    at0t;
    00188       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00189       typedef typename at1::type                    at1t;
    00190
    00191     public:
    00192       typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
    00193     };
    00194
    00195   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00196     struct container_base_dispatch<Key, Mapped, splay_tree_tag,
    00197                    Policy_Tl, Alloc>
    00198     {
    00199     private:
    00200       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00201       typedef typename at0::type                    at0t;
    00202       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00203       typedef typename at1::type                    at1t;
    00204
    00205     public:
    00206       typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc>  type;
    00207     };
    00208
    00209   template<typename Key, typename Policy_Tl, typename Alloc>
    00210     struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag,
    00211                    Policy_Tl, Alloc>
    00212     {
    00213     private:
    00214       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00215       typedef typename at0::type                    at0t;
    00216       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00217       typedef typename at1::type                    at1t;
    00218
    00219     public:
    00220       typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
    00221   };
    00222
    00223   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00224     struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc>
    00225     {
    00226     private:
    00227       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00228       typedef typename at0::type                    at0t;
    00229       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00230       typedef typename at1::type                    at1t;
    00231
    00232     public:
    00233       typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc>     type;
    00234   };
    00235
    00236   template<typename Key, typename Policy_Tl, typename Alloc>
    00237     struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag,
    00238                    Policy_Tl, Alloc>
    00239     {
    00240     private:
    00241       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00242       typedef typename at0::type                    at0t;
    00243       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00244       typedef typename at1::type                    at1t;
    00245
    00246     public:
    00247       typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
    00248   };
    00249
    00250   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00251     struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc>
    00252     {
    00253     private:
    00254       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00255       typedef typename at0::type                    at0t;
    00256       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00257       typedef typename at1::type                    at1t;
    00258       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>   at2;
    00259       typedef typename at2::type                    at2t;
    00260       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>   at3;
    00261       typedef typename at3::type                at3t;
    00262       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4>   at4;
    00263       typedef typename at4::type                    at4t;
    00264
    00265     public:
    00266       typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
    00267                   at4t, at2t>           type;
    00268   };
    00269
    00270   template<typename Key, typename Policy_Tl, typename Alloc>
    00271     struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag,
    00272                    Policy_Tl, Alloc>
    00273     {
    00274     private:
    00275       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00276       typedef typename at0::type                    at0t;
    00277       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00278       typedef typename at1::type                    at1t;
    00279       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>   at2;
    00280       typedef typename at2::type                    at2t;
    00281       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>   at3;
    00282       typedef typename at3::type                at3t;
    00283       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4>   at4;
    00284       typedef typename at4::type                    at4t;
    00285
    00286     public:
    00287       typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
    00288                  at3t::value, at4t, at2t>       type;
    00289   };
    00290
    00291   template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
    00292     struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc>
    00293     {
    00294     private:
    00295       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00296       typedef typename at0::type                    at0t;
    00297       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00298       typedef typename at1::type                    at1t;
    00299       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>   at2;
    00300       typedef typename at2::type                    at2t;
    00301       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>   at3;
    00302       typedef typename at3::type                at3t;
    00303       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4>   at4;
    00304       typedef typename at4::type                    at4t;
    00305       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5>   at5;
    00306       typedef typename at5::type                    at5t;
    00307
    00308     public:
    00309       typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
    00310                   at4t, at5t, at2t>         type;
    00311   };
    00312
    00313   template<typename Key, typename Policy_Tl, typename Alloc>
    00314     struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag,
    00315                    Policy_Tl, Alloc>
    00316     {
    00317     private:
    00318       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>   at0;
    00319       typedef typename at0::type                    at0t;
    00320       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>   at1;
    00321       typedef typename at1::type                    at1t;
    00322       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>   at2;
    00323       typedef typename at2::type                    at2t;
    00324       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>   at3;
    00325       typedef typename at3::type                at3t;
    00326       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4>   at4;
    00327       typedef typename at4::type                    at4t;
    00328       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5>   at5;
    00329       typedef typename at5::type                    at5t;
    00330
    00331     public:
    00332       typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
    00333                  at3t::value, at4t, at5t, at2t> type;
    00334   };
    00335 } // namespace detail
    00336 } // namespace __gnu_pbds
    00337
    00338 #endif