libzypp  11.13.5
Queue.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
11 #ifndef ZYPP_SAT_QUEUE_H
12 #define ZYPP_SAT_QUEUE_H
13 
14 extern "C"
15 {
16  struct _Queue;
17 }
18 #include <iosfwd>
19 
20 #include "zypp/base/NonCopyable.h"
22 
24 namespace zypp
25 {
26 
27  namespace sat
28  {
29 
32  class Queue : private base::NonCopyable
33  {
34  public:
35  typedef unsigned size_type;
37  typedef const value_type* const_iterator;
38 
39  public:
41  Queue();
42 
44  ~Queue();
45 
46  bool empty() const;
47  size_type size() const;
48  const_iterator begin() const;
49  const_iterator end() const;
50 
52  const_iterator find( value_type val_r ) const;
53 
55  bool contains( value_type val_r ) const
56  { return( find( val_r ) != end() ); }
57 
59  value_type first() const;
60 
62  value_type last() const;
63 
65  void clear();
66 
68  void remove( value_type val_r );
69 
71  void push( value_type val_r );
73  void push_back( value_type val_r )
74  { push( val_r ); }
75 
77  value_type pop();
80  { return pop(); }
81 
83  void push_front( value_type val_r );
84 
87 
88  public:
90  operator struct ::_Queue *()
91  { return _pimpl; }
93  operator const struct ::_Queue *() const
94  { return _pimpl; }
95 
96  private:
98  struct ::_Queue * _pimpl;
99  };
100 
102  std::ostream & operator<<( std::ostream & str, const Queue & obj );
103 
105  std::ostream & dumpOn( std::ostream & str, const Queue & obj );
106 
108  bool operator==( const Queue & lhs, const Queue & rhs );
109 
111  inline bool operator!=( const Queue & lhs, const Queue & rhs )
112  { return !( lhs == rhs ); }
113 
115  } // namespace sat
118 } // namespace zypp
120 #endif // ZYPP_SAT_QUEUE_H