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

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

    00001 /*
    00002  *
    00003  * Copyright (c) 1994
    00004  * Hewlett-Packard Company
    00005  *
    00006  * Permission to use, copy, modify, distribute and sell this software
    00007  * and its documentation for any purpose is hereby granted without fee,
    00008  * provided that the above copyright notice appear in all copies and
    00009  * that both that copyright notice and this permission notice appear
    00010  * in supporting documentation.  Hewlett-Packard Company makes no
    00011  * representations about the suitability of this software for any
    00012  * purpose.  It is provided "as is" without express or implied warranty.
    00013  *
    00014  *
    00015  * Copyright (c) 1996,1997
    00016  * Silicon Graphics Computer Systems, Inc.
    00017  *
    00018  * Permission to use, copy, modify, distribute and sell this software
    00019  * and its documentation for any purpose is hereby granted without fee,
    00020  * provided that the above copyright notice appear in all copies and
    00021  * that both that copyright notice and this permission notice appear
    00022  * in supporting documentation.  Silicon Graphics makes no
    00023  * representations about the suitability of this software for any
    00024  * purpose.  It is provided "as is" without express or implied warranty.
    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_MULTIMAP_H
    00032 #define __SGI_STL_INTERNAL_MULTIMAP_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 _Key, class _Tp, class _Compare = less<_Key>,
    00043           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
    00044 #else
    00045 template <class _Key, class _Tp, class _Compare,
    00046           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
    00047 #endif
    00048 class multimap {
    00049 public:
    00050
    00051 // typedefs:
    00052
    00053   typedef _Key                  key_type;
    00054   typedef _Tp                   data_type;
    00055   typedef _Tp                   mapped_type;
    00056   typedef pair<const _Key, _Tp> value_type;
    00057   typedef _Compare              key_compare;
    00058
    00059   class value_compare : public binary_function<value_type, value_type, bool> {
    00060   friend class multimap<_Key,_Tp,_Compare,_Alloc>;
    00061   protected:
    00062     _Compare _M_comp;
    00063     value_compare(_Compare __c) : _M_comp(__c) {}
    00064   public:
    00065     bool operator()(const value_type& __x, const value_type& __y) const {
    00066       return _M_comp(__x.first, __y.first);
    00067     }
    00068   };
    00069
    00070 private:
    00071   typedef _Rb_tree<key_type, value_type,
    00072                   _Select1st<value_type>, key_compare, _Alloc> _Rep_type;
    00073   _Rep_type _M_t;  // red-black tree representing multimap
    00074 public:
    00075   typedef typename _Rep_type::pointer pointer;
    00076   typedef typename _Rep_type::const_pointer const_pointer;
    00077   typedef typename _Rep_type::reference reference;
    00078   typedef typename _Rep_type::const_reference const_reference;
    00079   typedef typename _Rep_type::iterator iterator;
    00080   typedef typename _Rep_type::const_iterator const_iterator;
    00081   typedef typename _Rep_type::reverse_iterator reverse_iterator;
    00082   typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
    00083   typedef typename _Rep_type::size_type size_type;
    00084   typedef typename _Rep_type::difference_type difference_type;
    00085   typedef typename _Rep_type::allocator_type allocator_type;
    00086
    00087 // allocation/deallocation
    00088
    00089   multimap() : _M_t(_Compare(), allocator_type()) { }
    00090   explicit multimap(const _Compare& __comp,
    00091                     const allocator_type& __a = allocator_type())
    00092     : _M_t(__comp, __a) { }
    00093
    00094 #ifdef __STL_MEMBER_TEMPLATES
    00095   template <class _InputIterator>
    00096   multimap(_InputIterator __first, _InputIterator __last)
    00097     : _M_t(_Compare(), allocator_type())
    00098     { _M_t.insert_equal(__first, __last); }
    00099
    00100   template <class _InputIterator>
    00101   multimap(_InputIterator __first, _InputIterator __last,
    00102            const _Compare& __comp,
    00103            const allocator_type& __a = allocator_type())
    00104     : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
    00105 #else
    00106   multimap(const value_type* __first, const value_type* __last)
    00107     : _M_t(_Compare(), allocator_type())
    00108     { _M_t.insert_equal(__first, __last); }
    00109   multimap(const value_type* __first, const value_type* __last,
    00110            const _Compare& __comp,
    00111            const allocator_type& __a = allocator_type())
    00112     : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
    00113
    00114   multimap(const_iterator __first, const_iterator __last)
    00115     : _M_t(_Compare(), allocator_type())
    00116     { _M_t.insert_equal(__first, __last); }
    00117   multimap(const_iterator __first, const_iterator __last,
    00118            const _Compare& __comp,
    00119            const allocator_type& __a = allocator_type())
    00120     : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
    00121 #endif /* __STL_MEMBER_TEMPLATES */
    00122
    00123   multimap(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) { }
    00124   multimap<_Key,_Tp,_Compare,_Alloc>&
    00125   operator=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) {
    00126     _M_t = __x._M_t;
    00127     return *this;
    00128   }
    00129
    00130   // accessors:
    00131
    00132   key_compare key_comp() const { return _M_t.key_comp(); }
    00133   value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
    00134   allocator_type get_allocator() const { return _M_t.get_allocator(); }
    00135
    00136   iterator begin() { return _M_t.begin(); }
    00137   const_iterator begin() const { return _M_t.begin(); }
    00138   iterator end() { return _M_t.end(); }
    00139   const_iterator end() const { return _M_t.end(); }
    00140   reverse_iterator rbegin() { return _M_t.rbegin(); }
    00141   const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
    00142   reverse_iterator rend() { return _M_t.rend(); }
    00143   const_reverse_iterator rend() const { return _M_t.rend(); }
    00144   bool empty() const { return _M_t.empty(); }
    00145   size_type size() const { return _M_t.size(); }
    00146   size_type max_size() const { return _M_t.max_size(); }
    00147   void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
    00148
    00149   // insert/erase
    00150
    00151   iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
    00152   iterator insert(iterator __position, const value_type& __x) {
    00153     return _M_t.insert_equal(__position, __x);
    00154   }
    00155 #ifdef __STL_MEMBER_TEMPLATES
    00156   template <class _InputIterator>
    00157   void insert(_InputIterator __first, _InputIterator __last) {
    00158     _M_t.insert_equal(__first, __last);
    00159   }
    00160 #else
    00161   void insert(const value_type* __first, const value_type* __last) {
    00162     _M_t.insert_equal(__first, __last);
    00163   }
    00164   void insert(const_iterator __first, const_iterator __last) {
    00165     _M_t.insert_equal(__first, __last);
    00166   }
    00167 #endif /* __STL_MEMBER_TEMPLATES */
    00168   void erase(iterator __position) { _M_t.erase(__position); }
    00169   size_type erase(const key_type& __x) { return _M_t.erase(__x); }
    00170   void erase(iterator __first, iterator __last)
    00171     { _M_t.erase(__first, __last); }
    00172   void clear() { _M_t.clear(); }
    00173
    00174   // multimap operations:
    00175
    00176   iterator find(const key_type& __x) { return _M_t.find(__x); }
    00177   const_iterator find(const key_type& __x) const { return _M_t.find(__x); }
    00178   size_type count(const key_type& __x) const { return _M_t.count(__x); }
    00179   iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); }
    00180   const_iterator lower_bound(const key_type& __x) const {
    00181     return _M_t.lower_bound(__x);
    00182   }
    00183   iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); }
    00184   const_iterator upper_bound(const key_type& __x) const {
    00185     return _M_t.upper_bound(__x);
    00186   }
    00187    pair<iterator,iterator> equal_range(const key_type& __x) {
    00188     return _M_t.equal_range(__x);
    00189   }
    00190   pair<const_iterator,const_iterator> equal_range(const key_type& __x) const {
    00191     return _M_t.equal_range(__x);
    00192   }
    00193   friend bool operator== __STL_NULL_TMPL_ARGS (const multimap&,
    00194                                                const multimap&);
    00195   friend bool operator< __STL_NULL_TMPL_ARGS (const multimap&,
    00196                                               const multimap&);
    00197 };
    00198
    00199 template <class _Key, class _Tp, class _Compare, class _Alloc>
    00200 inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
    00201                        const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
    00202   return __x._M_t == __y._M_t;
    00203 }
    00204
    00205 template <class _Key, class _Tp, class _Compare, class _Alloc>
    00206 inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
    00207                       const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
    00208   return __x._M_t < __y._M_t;
    00209 }
    00210
    00211 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
    00212
    00213 template <class _Key, class _Tp, class _Compare, class _Alloc>
    00214 inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,
    00215                  multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
    00216   __x.swap(__y);
    00217 }
    00218
    00219 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
    00220
    00221 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
    00222 #pragma reset woff 1174
    00223 #pragma reset woff 1375
    00224 #endif
    00225
    00226 __STL_END_NAMESPACE
    00227
    00228 #endif /* __SGI_STL_INTERNAL_MULTIMAP_H */
    00229
    00230 // Local Variables:
    00231 // mode:C++
    00232 // End: