1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/sat/Queue.h
11 #ifndef ZYPP_SAT_QUEUE_H
12 #define ZYPP_SAT_QUEUE_H
20 #include "zypp/base/NonCopyable.h"
21 #include "zypp/sat/detail/PoolMember.h"
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
30 /** Libsolv Id queue wrapper.
32 class Queue : private base::NonCopyable
35 typedef unsigned size_type;
36 typedef detail::IdType value_type;
37 typedef const value_type* const_iterator;
40 /** Default ctor: empty Queue. */
47 size_type size() const;
48 const_iterator begin() const;
49 const_iterator end() const;
51 /** Return iterator to the 1st occurance of \a val_r or \ref end. */
52 const_iterator find( value_type val_r ) const;
54 /** Return whether the Queue contais at lest one element with value \a val_r. */
55 bool contains( value_type val_r ) const
56 { return( find( val_r ) != end() ); }
58 /** Return the 1st Id in the queue or \c 0 if empty. */
59 value_type first() const;
61 /** Return the last Id in the queue or \c 0 if empty. */
62 value_type last() const;
64 /** Clear the queue. */
67 /** Remove all occurances of \a val_r from the queue. */
68 void remove( value_type val_r );
70 /** Push a value to the end off the Queue. */
71 void push( value_type val_r );
73 void push_back( value_type val_r )
76 /** Pop and return the last Id from the queue or \c 0 if empty. */
82 /** Push a value to the beginning off the Queue. */
83 void push_front( value_type val_r );
85 /** Pop and return the 1st Id from the queue or \c 0 if empty. */
86 value_type pop_front();
90 operator struct ::_Queue *()
93 operator const struct ::_Queue *() const
97 /** Pointer to implementation */
98 struct ::_Queue * _pimpl;
101 /** \relates Queue Stream output */
102 std::ostream & operator<<( std::ostream & str, const Queue & obj );
104 /** \relates Queue Verbose stream output */
105 std::ostream & dumpOn( std::ostream & str, const Queue & obj );
107 /** \relates Queue */
108 bool operator==( const Queue & lhs, const Queue & rhs );
110 /** \relates Queue */
111 inline bool operator!=( const Queue & lhs, const Queue & rhs )
112 { return !( lhs == rhs ); }
114 /////////////////////////////////////////////////////////////////
116 ///////////////////////////////////////////////////////////////////
117 /////////////////////////////////////////////////////////////////
119 ///////////////////////////////////////////////////////////////////
120 #endif // ZYPP_SAT_QUEUE_H