_hash_map.h

00001 /*
00002  * Copyright (c) 1999, 2000
00003  * Boris Fomitchev
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted 
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 /* NOTE: This is an internal header file, included by other STL headers.
00017  *   You should not attempt to use it directly.
00018  */
00019 
00020 #ifndef _STLP_INTERNAL_WRAP_HASH_MAP_H
00021 #define _STLP_INTERNAL_WRAP_HASH_MAP_H
00022 
00023 #ifndef _STLP_INTERNAL_HASH_MAP_H
00024 # include <stl/_hash_map.h>
00025 #endif
00026 
00027 # ifdef _STLP_USE_NAMESPACES
00028 namespace STLPORT { 
00029 # endif
00030 
00031 // provide a "default" hash_map adaptor
00032 #  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
00033 #   define __HM_TEMPLATE_HEADER  template <class _Key, class _Tp>
00034 #   define __HM_ARGUMENTS        _Key, _Tp
00035 #   define __HM_BASE_ARGUMENTS   _Key, _Tp, hash<_Key>, equal_to<_Key>, _STLP_DEFAULT_PAIR_ALLOCATOR(const _Key, _Tp)
00036 #  else
00037 #   define __HM_TEMPLATE_HEADER  template <class _Key, class _Tp, class _HashFcn, class _EqualKey >
00038 #   define __HM_ARGUMENTS        _Key, _Tp, _HashFcn, _EqualKey
00039 #   define __HM_BASE_ARGUMENTS   _Key, _Tp, _HashFcn, _EqualKey, _STLP_DEFAULT_PAIR_ALLOCATOR(const _Key, _Tp)
00040 #  endif
00041 
00042 
00043 # define __HM_SUPER  __hash_map< __HM_BASE_ARGUMENTS >
00044 # define __HMM_SUPER __hash_multimap< __HM_BASE_ARGUMENTS >
00045 
00046 __HM_TEMPLATE_HEADER
00047 class hash_map : public __HM_SUPER
00048 {
00049   typedef hash_map< __HM_ARGUMENTS > _Self;
00050 public:
00051   typedef __HM_SUPER _Super;
00052   __IMPORT_WITH_ITERATORS(_Super)
00053   typedef typename _Super::key_type key_type;
00054   typedef typename _Super::hasher hasher;
00055   typedef typename _Super::key_equal key_equal;
00056   typedef _Tp data_type;
00057   hash_map() {}
00058   hash_map(size_type __n) : __HM_SUPER(__n) {}
00059   hash_map(size_type __n, const hasher& __hf) : __HM_SUPER(__n, __hf) {}
00060   hash_map(size_type __n, const hasher& __hf, const key_equal& __eql): __HM_SUPER(__n, __hf, __eql) {}
00061   hash_map(const value_type* __f, const value_type* __l) : __HM_SUPER(__f,__l) {}
00062   hash_map(const value_type* __f, const value_type* __l, size_type __n): __HM_SUPER(__f,__l,__n) {}
00063   hash_map(const value_type* __f, const value_type* __l, size_type __n, 
00064            const hasher& __hf) : __HM_SUPER(__f,__l,__n,__hf) {}
00065   hash_map(const value_type* __f, const value_type* __l, size_type __n,
00066            const hasher& __hf, const key_equal& __eql) : __HM_SUPER(__f,__l,__n,__hf, __eql) {}
00067   hash_map(const_iterator __f, const_iterator __l) : __HM_SUPER(__f,__l) { }
00068   hash_map(const_iterator __f, const_iterator __l, size_type __n) : __HM_SUPER(__f,__l,__n) { }
00069   hash_map(const_iterator __f, const_iterator __l, size_type __n,
00070            const hasher& __hf) : __HM_SUPER(__f, __l, __n, __hf) { }
00071   hash_map(const_iterator __f, const_iterator __l, size_type __n,
00072            const hasher& __hf, const key_equal& __eql) : __HM_SUPER(__f, __l, __n, __hf, __eql) { }
00073 # if defined (_STLP_BASE_MATCH_BUG)
00074   friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hm1, const _Self& __hm2);
00075 # endif
00076 };
00077 
00078 
00079 # if defined (_STLP_BASE_MATCH_BUG)
00080 __HM_TEMPLATE_HEADER
00081 inline bool operator==(const hash_map< __HM_ARGUMENTS >& __hm1, 
00082                        const hash_map< __HM_ARGUMENTS >& __hm2)
00083 {
00084     typedef __HM_SUPER _Super;
00085     return (const _Super&)__hm1 == (const _Super&)__hm2; 
00086 }
00087 # endif
00088 
00089 // provide a "default" hash_multimap adaptor
00090 __HM_TEMPLATE_HEADER
00091 class hash_multimap : public __HMM_SUPER
00092 {
00093   typedef hash_multimap< __HM_ARGUMENTS > _Self;
00094 public:
00095   typedef __HMM_SUPER _Super;
00096   __IMPORT_WITH_ITERATORS(_Super)
00097   typedef typename _Super::key_type key_type;
00098   typedef typename _Super::hasher hasher;
00099   typedef typename _Super::key_equal key_equal;
00100   typedef _Tp data_type;
00101   hash_multimap() {}
00102   hash_multimap(size_type __n) : __HMM_SUPER(__n) {}
00103   hash_multimap(size_type __n, const hasher& __hf) : __HMM_SUPER(__n, __hf) {}
00104   hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql): __HMM_SUPER(__n, __hf, __eql) {}
00105   hash_multimap(const value_type* __f, const value_type* __l) : __HMM_SUPER(__f,__l) {}
00106   hash_multimap(const value_type* __f, const value_type* __l, size_type __n): __HMM_SUPER(__f,__l,__n) {}
00107   hash_multimap(const value_type* __f, const value_type* __l, size_type __n, 
00108            const hasher& __hf) : __HMM_SUPER(__f,__l,__n,__hf) {}
00109   hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
00110            const hasher& __hf, const key_equal& __eql) : __HMM_SUPER(__f,__l,__n,__hf, __eql) {}
00111 
00112   hash_multimap(const_iterator __f, const_iterator __l) : __HMM_SUPER(__f,__l) { }
00113   hash_multimap(const_iterator __f, const_iterator __l, size_type __n) : __HMM_SUPER(__f,__l,__n) { }
00114   hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
00115            const hasher& __hf) : __HMM_SUPER(__f, __l, __n, __hf) { }
00116   hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
00117            const hasher& __hf, const key_equal& __eql) : __HMM_SUPER(__f, __l, __n, __hf, __eql) { }
00118 # if defined (_STLP_BASE_MATCH_BUG)
00119   friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hm1, const _Self& __hm2);
00120 # endif
00121 };
00122 
00123 # if defined (_STLP_BASE_MATCH_BUG)
00124 __HM_TEMPLATE_HEADER
00125 inline bool operator==(const hash_multimap< __HM_ARGUMENTS >& __hm1, 
00126                        const hash_multimap< __HM_ARGUMENTS >& __hm2)
00127 {
00128     typedef __HMM_SUPER _Super;
00129     return (const _Super&)__hm1 == (const _Super&)__hm2; 
00130 }
00131 # endif
00132 
00133 # undef __HM_SUPER
00134 # undef __HMM_SUPER
00135 # undef __HM_TEMPLATE_HEADER
00136 # undef __HM_ARGUMENTS
00137 # undef __HM_BASE_ARGUMENTS
00138 
00139 # ifdef _STLP_USE_NAMESPACES
00140 } /* namespace STLPORT */
00141 # endif
00142 
00143 #endif /* _STLP_INTERNAL_HASH_SET_H */
00144 
00145 // Local Variables:
00146 // mode:C++
00147 // End:

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6