- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Configs/TI_DSP_BIOS/stl/stl_hash_set.h

    00001 /*
    00002  * Copyright (c) 1996
    00003  * Silicon Graphics Computer Systems, Inc.
    00004  *
    00005  * Permission to use, copy, modify, distribute and sell this software
    00006  * and its documentation for any purpose is hereby granted without fee,
    00007  * provided that the above copyright notice appear in all copies and
    00008  * that both that copyright notice and this permission notice appear
    00009  * in supporting documentation.  Silicon Graphics makes no
    00010  * representations about the suitability of this software for any
    00011  * purpose.  It is provided "as is" without express or implied warranty.
    00012  *
    00013  *
    00014  * Copyright (c) 1994
    00015  * Hewlett-Packard Company
    00016  *
    00017  * Permission to use, copy, modify, distribute and sell this software
    00018  * and its documentation for any purpose is hereby granted without fee,
    00019  * provided that the above copyright notice appear in all copies and
    00020  * that both that copyright notice and this permission notice appear
    00021  * in supporting documentation.  Hewlett-Packard Company makes no
    00022  * representations about the suitability of this software for any
    00023  * purpose.  It is provided "as is" without express or implied warranty.
    00024  *
    00025  */
    00026
    00027 /* NOTE: This is an internal header file, included by other STL headers.
    00028  *   You should not attempt to use it directly.
    00029  */
    00030
    00031 #ifndef __SGI_STL_INTERNAL_HASH_SET_H
    00032 #define __SGI_STL_INTERNAL_HASH_SET_H
    00033
    00034 __STL_BEGIN_NAMESPACE
    00035
    00036 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
    00037 #pragma set woff 1174
    00038 #pragma set woff 1375
    00039 #endif
    00040
    00041 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
    00042 template <class _Value, class _HashFcn = hash<_Value>,
    00043           class _EqualKey = equal_to<_Value>,
    00044           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
    00045 #else
    00046 template <class _Value, class _HashFcn, class _EqualKey,
    00047           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
    00048 #endif
    00049 class hash_set
    00050 {
    00051 private:
    00052   typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
    00053                     _EqualKey, _Alloc> _Ht;
    00054   _Ht _M_ht;
    00055
    00056 public:
    00057   typedef typename _Ht::key_type key_type;
    00058   typedef typename _Ht::value_type value_type;
    00059   typedef typename _Ht::hasher hasher;
    00060   typedef typename _Ht::key_equal key_equal;
    00061
    00062   typedef typename _Ht::size_type size_type;
    00063   typedef typename _Ht::difference_type difference_type;
    00064   typedef typename _Ht::const_pointer pointer;
    00065   typedef typename _Ht::const_pointer const_pointer;
    00066   typedef typename _Ht::const_reference reference;
    00067   typedef typename _Ht::const_reference const_reference;
    00068
    00069   typedef typename _Ht::const_iterator iterator;
    00070   typedef typename _Ht::const_iterator const_iterator;
    00071
    00072   typedef typename _Ht::allocator_type allocator_type;
    00073
    00074   hasher hash_funct() const { return _M_ht.hash_funct(); }
    00075   key_equal key_eq() const { return _M_ht.key_eq(); }
    00076   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
    00077
    00078 public:
    00079   hash_set()
    00080     : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
    00081   explicit hash_set(size_type __n)
    00082     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
    00083   hash_set(size_type __n, const hasher& __hf)
    00084     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
    00085   hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
    00086            const allocator_type& __a = allocator_type())
    00087     : _M_ht(__n, __hf, __eql, __a) {}
    00088
    00089 #ifdef __STL_MEMBER_TEMPLATES
    00090   template <class _InputIterator>
    00091   hash_set(_InputIterator __f, _InputIterator __l)
    00092     : _M_ht(100, hasher(), key_equal(), allocator_type())
    00093     { _M_ht.insert_unique(__f, __l); }
    00094   template <class _InputIterator>
    00095   hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
    00096     : _M_ht(__n, hasher(), key_equal(), allocator_type())
    00097     { _M_ht.insert_unique(__f, __l); }
    00098   template <class _InputIterator>
    00099   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
    00100            const hasher& __hf)
    00101     : _M_ht(__n, __hf, key_equal(), allocator_type())
    00102     { _M_ht.insert_unique(__f, __l); }
    00103   template <class _InputIterator>
    00104   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
    00105            const hasher& __hf, const key_equal& __eql,
    00106            const allocator_type& __a = allocator_type())
    00107     : _M_ht(__n, __hf, __eql, __a)
    00108     { _M_ht.insert_unique(__f, __l); }
    00109 #else
    00110
    00111   hash_set(const value_type* __f, const value_type* __l)
    00112     : _M_ht(100, hasher(), key_equal(), allocator_type())
    00113     { _M_ht.insert_unique(__f, __l); }
    00114   hash_set(const value_type* __f, const value_type* __l, size_type __n)
    00115     : _M_ht(__n, hasher(), key_equal(), allocator_type())
    00116     { _M_ht.insert_unique(__f, __l); }
    00117   hash_set(const value_type* __f, const value_type* __l, size_type __n,
    00118            const hasher& __hf)
    00119     : _M_ht(__n, __hf, key_equal(), allocator_type())
    00120     { _M_ht.insert_unique(__f, __l); }
    00121   hash_set(const value_type* __f, const value_type* __l, size_type __n,
    00122            const hasher& __hf, const key_equal& __eql,
    00123            const allocator_type& __a = allocator_type())
    00124     : _M_ht(__n, __hf, __eql, __a)
    00125     { _M_ht.insert_unique(__f, __l); }
    00126
    00127   hash_set(const_iterator __f, const_iterator __l)
    00128     : _M_ht(100, hasher(), key_equal(), allocator_type())
    00129     { _M_ht.insert_unique(__f, __l); }
    00130   hash_set(const_iterator __f, const_iterator __l, size_type __n)
    00131     : _M_ht(__n, hasher(), key_equal(), allocator_type())
    00132     { _M_ht.insert_unique(__f, __l); }
    00133   hash_set(const_iterator __f, const_iterator __l, size_type __n,
    00134            const hasher& __hf)
    00135     : _M_ht(__n, __hf, key_equal(), allocator_type())
    00136     { _M_ht.insert_unique(__f, __l); }
    00137   hash_set(const_iterator __f, const_iterator __l, size_type __n,
    00138            const hasher& __hf, const key_equal& __eql,
    00139            const allocator_type& __a = allocator_type())
    00140     : _M_ht(__n, __hf, __eql, __a)
    00141     { _M_ht.insert_unique(__f, __l); }
    00142 #endif /*__STL_MEMBER_TEMPLATES */
    00143
    00144 public:
    00145   size_type size() const { return _M_ht.size(); }
    00146   size_type max_size() const { return _M_ht.max_size(); }
    00147   bool empty() const { return _M_ht.empty(); }
    00148   void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
    00149   friend bool operator== __STL_NULL_TMPL_ARGS (const hash_set&,
    00150                                                const hash_set&);
    00151
    00152   iterator begin() const { return _M_ht.begin(); }
    00153   iterator end() const { return _M_ht.end(); }
    00154
    00155 public:
    00156   pair<iterator, bool> insert(const value_type& __obj)
    00157     {
    00158       pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
    00159       return pair<iterator,bool>(__p.first, __p.second);
    00160     }
    00161 #ifdef __STL_MEMBER_TEMPLATES
    00162   template <class _InputIterator>
    00163   void insert(_InputIterator __f, _InputIterator __l)
    00164     { _M_ht.insert_unique(__f,__l); }
    00165 #else
    00166   void insert(const value_type* __f, const value_type* __l) {
    00167     _M_ht.insert_unique(__f,__l);
    00168   }
    00169   void insert(const_iterator __f, const_iterator __l)
    00170     {_M_ht.insert_unique(__f, __l); }
    00171 #endif /*__STL_MEMBER_TEMPLATES */
    00172   pair<iterator, bool> insert_noresize(const value_type& __obj)
    00173   {
    00174     pair<typename _Ht::iterator, bool> __p =
    00175       _M_ht.insert_unique_noresize(__obj);
    00176     return pair<iterator, bool>(__p.first, __p.second);
    00177   }
    00178
    00179   iterator find(const key_type& __key) const { return _M_ht.find(__key); }
    00180
    00181   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
    00182
    00183   pair<iterator, iterator> equal_range(const key_type& __key) const
    00184     { return _M_ht.equal_range(__key); }
    00185
    00186   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
    00187   void erase(iterator __it) { _M_ht.erase(__it); }
    00188   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
    00189   void clear() { _M_ht.clear(); }
    00190
    00191 public:
    00192   void resize(size_type __hint) { _M_ht.resize(__hint); }
    00193   size_type bucket_count() const { return _M_ht.bucket_count(); }
    00194   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
    00195   size_type elems_in_bucket(size_type __n) const
    00196     { return _M_ht.elems_in_bucket(__n); }
    00197 };
    00198
    00199 template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
    00200 inline bool
    00201 operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
    00202            const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
    00203 {
    00204   return __hs1._M_ht == __hs2._M_ht;
    00205 }
    00206
    00207 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
    00208
    00209 template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
    00210 inline void
    00211 swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
    00212      hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
    00213 {
    00214   __hs1.swap(__hs2);
    00215 }
    00216
    00217 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
    00218
    00219
    00220 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
    00221 template <class _Value, class _HashFcn = hash<_Value>,
    00222           class _EqualKey = equal_to<_Value>,
    00223           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
    00224 #else
    00225 template <class _Value, class _HashFcn, class _EqualKey,
    00226           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
    00227 #endif
    00228 class hash_multiset
    00229 {
    00230 private:
    00231   typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
    00232                     _EqualKey, _Alloc> _Ht;
    00233   _Ht _M_ht;
    00234
    00235 public:
    00236   typedef typename _Ht::key_type key_type;
    00237   typedef typename _Ht::value_type value_type;
    00238   typedef typename _Ht::hasher hasher;
    00239   typedef typename _Ht::key_equal key_equal;
    00240
    00241   typedef typename _Ht::size_type size_type;
    00242   typedef typename _Ht::difference_type difference_type;
    00243   typedef typename _Ht::const_pointer pointer;
    00244   typedef typename _Ht::const_pointer const_pointer;
    00245   typedef typename _Ht::const_reference reference;
    00246   typedef typename _Ht::const_reference const_reference;
    00247
    00248   typedef typename _Ht::const_iterator iterator;
    00249   typedef typename _Ht::const_iterator const_iterator;
    00250
    00251   typedef typename _Ht::allocator_type allocator_type;
    00252
    00253   hasher hash_funct() const { return _M_ht.hash_funct(); }
    00254   key_equal key_eq() const { return _M_ht.key_eq(); }
    00255   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
    00256
    00257 public:
    00258   hash_multiset()
    00259     : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
    00260   explicit hash_multiset(size_type __n)
    00261     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
    00262   hash_multiset(size_type __n, const hasher& __hf)
    00263     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
    00264   hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
    00265                 const allocator_type& __a = allocator_type())
    00266     : _M_ht(__n, __hf, __eql, __a) {}
    00267
    00268 #ifdef __STL_MEMBER_TEMPLATES
    00269   template <class _InputIterator>
    00270   hash_multiset(_InputIterator __f, _InputIterator __l)
    00271     : _M_ht(100, hasher(), key_equal(), allocator_type())
    00272     { _M_ht.insert_equal(__f, __l); }
    00273   template <class _InputIterator>
    00274   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
    00275     : _M_ht(__n, hasher(), key_equal(), allocator_type())
    00276     { _M_ht.insert_equal(__f, __l); }
    00277   template <class _InputIterator>
    00278   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
    00279                 const hasher& __hf)
    00280     : _M_ht(__n, __hf, key_equal(), allocator_type())
    00281     { _M_ht.insert_equal(__f, __l); }
    00282   template <class _InputIterator>
    00283   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
    00284                 const hasher& __hf, const key_equal& __eql,
    00285                 const allocator_type& __a = allocator_type())
    00286     : _M_ht(__n, __hf, __eql, __a)
    00287     { _M_ht.insert_equal(__f, __l); }
    00288 #else
    00289
    00290   hash_multiset(const value_type* __f, const value_type* __l)
    00291     : _M_ht(100, hasher(), key_equal(), allocator_type())
    00292     { _M_ht.insert_equal(__f, __l); }
    00293   hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
    00294     : _M_ht(__n, hasher(), key_equal(), allocator_type())
    00295     { _M_ht.insert_equal(__f, __l); }
    00296   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
    00297                 const hasher& __hf)
    00298     : _M_ht(__n, __hf, key_equal(), allocator_type())
    00299     { _M_ht.insert_equal(__f, __l); }
    00300   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
    00301                 const hasher& __hf, const key_equal& __eql,
    00302                 const allocator_type& __a = allocator_type())
    00303     : _M_ht(__n, __hf, __eql, __a)
    00304     { _M_ht.insert_equal(__f, __l); }
    00305
    00306   hash_multiset(const_iterator __f, const_iterator __l)
    00307     : _M_ht(100, hasher(), key_equal(), allocator_type())
    00308     { _M_ht.insert_equal(__f, __l); }
    00309   hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
    00310     : _M_ht(__n, hasher(), key_equal(), allocator_type())
    00311     { _M_ht.insert_equal(__f, __l); }
    00312   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
    00313                 const hasher& __hf)
    00314     : _M_ht(__n, __hf, key_equal(), allocator_type())
    00315     { _M_ht.insert_equal(__f, __l); }
    00316   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
    00317                 const hasher& __hf, const key_equal& __eql,
    00318                 const allocator_type& __a = allocator_type())
    00319     : _M_ht(__n, __hf, __eql, __a)
    00320     { _M_ht.insert_equal(__f, __l); }
    00321 #endif /*__STL_MEMBER_TEMPLATES */
    00322
    00323 public:
    00324   size_type size() const { return _M_ht.size(); }
    00325   size_type max_size() const { return _M_ht.max_size(); }
    00326   bool empty() const { return _M_ht.empty(); }
    00327   void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
    00328   friend bool operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,
    00329                                                const hash_multiset&);
    00330
    00331   iterator begin() const { return _M_ht.begin(); }
    00332   iterator end() const { return _M_ht.end(); }
    00333
    00334 public:
    00335   iterator insert(const value_type& __obj)
    00336     { return _M_ht.insert_equal(__obj); }
    00337 #ifdef __STL_MEMBER_TEMPLATES
    00338   template <class _InputIterator>
    00339   void insert(_InputIterator __f, _InputIterator __l)
    00340     { _M_ht.insert_equal(__f,__l); }
    00341 #else
    00342   void insert(const value_type* __f, const value_type* __l) {
    00343     _M_ht.insert_equal(__f,__l);
    00344   }
    00345   void insert(const_iterator __f, const_iterator __l)
    00346     { _M_ht.insert_equal(__f, __l); }
    00347 #endif /*__STL_MEMBER_TEMPLATES */
    00348   iterator insert_noresize(const value_type& __obj)
    00349     { return _M_ht.insert_equal_noresize(__obj); }
    00350
    00351   iterator find(const key_type& __key) const { return _M_ht.find(__key); }
    00352
    00353   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
    00354
    00355   pair<iterator, iterator> equal_range(const key_type& __key) const
    00356     { return _M_ht.equal_range(__key); }
    00357
    00358   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
    00359   void erase(iterator __it) { _M_ht.erase(__it); }
    00360   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
    00361   void clear() { _M_ht.clear(); }
    00362
    00363 public:
    00364   void resize(size_type __hint) { _M_ht.resize(__hint); }
    00365   size_type bucket_count() const { return _M_ht.bucket_count(); }
    00366   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
    00367   size_type elems_in_bucket(size_type __n) const
    00368     { return _M_ht.elems_in_bucket(__n); }
    00369 };
    00370
    00371 template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
    00372 inline bool
    00373 operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
    00374            const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
    00375 {
    00376   return __hs1._M_ht == __hs2._M_ht;
    00377 }
    00378
    00379 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
    00380
    00381 template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
    00382 inline void
    00383 swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
    00384      hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
    00385   __hs1.swap(__hs2);
    00386 }
    00387
    00388 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
    00389
    00390 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
    00391 #pragma reset woff 1174
    00392 #pragma reset woff 1375
    00393 #endif
    00394
    00395 __STL_END_NAMESPACE
    00396
    00397 #endif /* __SGI_STL_INTERNAL_HASH_SET_H */
    00398
    00399 // Local Variables:
    00400 // mode:C++
    00401 // End: