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

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Configs/TI_DSP_BIOS/stl/stl_queue.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_QUEUE_H
    00032 #define __SGI_STL_INTERNAL_QUEUE_H
    00033
    00034 __STL_BEGIN_NAMESPACE
    00035
    00036 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
    00037 template <class _Tp, class _Sequence = deque<_Tp> >
    00038 #else
    00039 template <class _Tp, class _Sequence>
    00040 #endif
    00041 class queue {
    00042   friend bool operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&);
    00043   friend bool operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&);
    00044 public:
    00045   typedef typename _Sequence::value_type      value_type;
    00046   typedef typename _Sequence::size_type       size_type;
    00047   typedef          _Sequence                  container_type;
    00048
    00049   typedef typename _Sequence::reference       reference;
    00050   typedef typename _Sequence::const_reference const_reference;
    00051 protected:
    00052   _Sequence c;
    00053 public:
    00054   queue() : c() {}
    00055   explicit queue(const _Sequence& __c) : c(__c) {}
    00056
    00057   bool empty() const { return c.empty(); }
    00058   size_type size() const { return c.size(); }
    00059   reference front() { return c.front(); }
    00060   const_reference front() const { return c.front(); }
    00061   reference back() { return c.back(); }
    00062   const_reference back() const { return c.back(); }
    00063   void push(const value_type& __x) { c.push_back(__x); }
    00064   void pop() { c.pop_front(); }
    00065 };
    00066
    00067 template <class _Tp, class _Sequence>
    00068 bool
    00069 operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
    00070 {
    00071   return __x.c == __y.c;
    00072 }
    00073
    00074 template <class _Tp, class _Sequence>
    00075 bool
    00076 operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
    00077 {
    00078   return __x.c < __y.c;
    00079 }
    00080
    00081 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
    00082
    00083 template <class _Tp, class _Sequence>
    00084 bool
    00085 operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
    00086 {
    00087   return !(__x == __y);
    00088 }
    00089
    00090 template <class _Tp, class _Sequence>
    00091 bool
    00092 operator>(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
    00093 {
    00094   return __y < __x;
    00095 }
    00096
    00097 template <class _Tp, class _Sequence>
    00098 bool
    00099 operator<=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
    00100 {
    00101   return !(__y < __x);
    00102 }
    00103
    00104 template <class _Tp, class _Sequence>
    00105 bool
    00106 operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
    00107 {
    00108   return !(__x < __y);
    00109 }
    00110
    00111 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
    00112
    00113 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
    00114 template <class _Tp, class _Sequence = vector<_Tp>,
    00115           class _Compare = less<typename _Sequence::value_type> >
    00116 #else
    00117 template <class _Tp, class _Sequence, class _Compare>
    00118 #endif
    00119 class  priority_queue {
    00120 public:
    00121   typedef typename _Sequence::value_type      value_type;
    00122   typedef typename _Sequence::size_type       size_type;
    00123   typedef          _Sequence                  container_type;
    00124
    00125   typedef typename _Sequence::reference       reference;
    00126   typedef typename _Sequence::const_reference const_reference;
    00127 protected:
    00128   _Sequence c;
    00129   _Compare comp;
    00130 public:
    00131   priority_queue() : c() {}
    00132   explicit priority_queue(const _Compare& __x) :  c(), comp(__x) {}
    00133   priority_queue(const _Compare& __x, const _Sequence& __s)
    00134     : c(__s), comp(__x)
    00135     { make_heap(c.begin(), c.end(), comp); }
    00136
    00137 #ifdef __STL_MEMBER_TEMPLATES
    00138   template <class _InputIterator>
    00139   priority_queue(_InputIterator __first, _InputIterator __last)
    00140     : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
    00141
    00142   template <class _InputIterator>
    00143   priority_queue(_InputIterator __first,
    00144                  _InputIterator __last, const _Compare& __x)
    00145     : c(__first, __last), comp(__x)
    00146     { make_heap(c.begin(), c.end(), comp); }
    00147
    00148   template <class _InputIterator>
    00149   priority_queue(_InputIterator __first, _InputIterator __last,
    00150                  const _Compare& __x, const _Sequence& __s)
    00151   : c(__s), comp(__x)
    00152   {
    00153     c.insert(c.end(), __first, __last);
    00154     make_heap(c.begin(), c.end(), comp);
    00155   }
    00156
    00157 #else /* __STL_MEMBER_TEMPLATES */
    00158   priority_queue(const value_type* __first, const value_type* __last)
    00159     : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
    00160
    00161   priority_queue(const value_type* __first, const value_type* __last,
    00162                  const _Compare& __x)
    00163     : c(__first, __last), comp(__x)
    00164     { make_heap(c.begin(), c.end(), comp); }
    00165
    00166   priority_queue(const value_type* __first, const value_type* __last,
    00167                  const _Compare& __x, const _Sequence& __c)
    00168     : c(__c), comp(__x)
    00169   {
    00170     c.insert(c.end(), __first, __last);
    00171     make_heap(c.begin(), c.end(), comp);
    00172   }
    00173 #endif /* __STL_MEMBER_TEMPLATES */
    00174
    00175   bool empty() const { return c.empty(); }
    00176   size_type size() const { return c.size(); }
    00177   const_reference top() const { return c.front(); }
    00178   void push(const value_type& __x) {
    00179     __STL_TRY {
    00180       c.push_back(__x);
    00181       push_heap(c.begin(), c.end(), comp);
    00182     }
    00183     __STL_UNWIND(c.clear());
    00184   }
    00185   void pop() {
    00186     __STL_TRY {
    00187       pop_heap(c.begin(), c.end(), comp);
    00188       c.pop_back();
    00189     }
    00190     __STL_UNWIND(c.clear());
    00191   }
    00192 };
    00193
    00194 // no equality is provided
    00195
    00196 __STL_END_NAMESPACE
    00197
    00198 #endif /* __SGI_STL_INTERNAL_QUEUE_H */
    00199
    00200 // Local Variables:
    00201 // mode:C++
    00202 // End: