libzypp  10.5.0
Queue.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00011 #ifndef ZYPP_SAT_QUEUE_H
00012 #define ZYPP_SAT_QUEUE_H
00013 
00014 extern "C"
00015 {
00016   struct _Queue;
00017 }
00018 #include <iosfwd>
00019 
00020 #include "zypp/base/NonCopyable.h"
00021 #include "zypp/sat/detail/PoolMember.h"
00022 
00024 namespace zypp
00025 { 
00026 
00027   namespace sat
00028   { 
00029 
00032     class Queue : private base::NonCopyable
00033     {
00034       public:
00035         typedef unsigned size_type;
00036         typedef detail::IdType value_type;
00037         typedef const value_type* const_iterator;
00038 
00039       public:
00041         Queue();
00042 
00044         ~Queue();
00045 
00046         bool empty() const;
00047         size_type size() const;
00048         const_iterator begin() const;
00049         const_iterator end() const;
00050 
00052         const_iterator find( value_type val_r ) const;
00053 
00055         bool contains( value_type val_r ) const
00056         { return( find( val_r ) != end() ); }
00057 
00059         value_type first() const;
00060 
00062         value_type last() const;
00063 
00065         void clear();
00066 
00068         void remove( value_type val_r );
00069 
00071         void push( value_type val_r );
00073         void push_back( value_type val_r )
00074         { push( val_r ); }
00075 
00077         value_type pop();
00079         value_type pop_back()
00080         { return pop(); }
00081 
00083         void push_front( value_type val_r );
00084 
00086         value_type pop_front();
00087 
00088      public:
00090         operator struct ::_Queue *()
00091         { return _pimpl; }
00093         operator const struct ::_Queue *() const
00094         { return _pimpl; }
00095 
00096       private:
00098         struct ::_Queue * _pimpl;
00099     };
00100 
00102     std::ostream & operator<<( std::ostream & str, const Queue & obj );
00103 
00105     std::ostream & dumpOn( std::ostream & str, const Queue & obj );
00106 
00108   } // namespace sat
00111 } // namespace zypp
00113 #endif // ZYPP_SAT_QUEUE_H