container_base_dispatch.hpp

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

Generated on Thu Jul 23 21:16:02 2009 for libstdc++ by  doxygen 1.5.8