--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/sat/Queue.cc
+ */
+extern "C"
+{
+#include "satsolver/queue.h"
+}
+#include <iostream>
+#include "zypp/base/LogTools.h"
+
+#include "zypp/sat/Queue.h"
+#include "zypp/sat/Solvable.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ { /////////////////////////////////////////////////////////////////
+
+ Queue::Queue()
+ : _pimpl( new struct ::_Queue )
+ {
+ ::queue_init( _pimpl );
+ }
+
+ Queue::~Queue()
+ {
+ ::queue_free( _pimpl );
+ delete( _pimpl );
+ }
+
+ bool Queue::empty() const
+ { return( _pimpl->count == 0 ); }
+
+ Queue::size_type Queue::size() const
+ { return _pimpl->count; }
+
+ Queue::const_iterator Queue::begin() const
+ { return _pimpl->elements; }
+
+ Queue::const_iterator Queue::end() const
+ { return _pimpl->elements + _pimpl->count;}
+
+ void Queue::push( value_type val_r )
+ { ::queue_push( _pimpl, val_r ); }
+
+ Queue::value_type Queue::pop()
+ { ::queue_pop( _pimpl ); }
+
+ Queue::value_type Queue::first() const
+ {
+ if ( empty() )
+ return 0;
+ return *_pimpl->elements;
+ }
+
+ void Queue::clear()
+ { ::queue_empty( *this ); }
+
+ std::ostream & operator<<( std::ostream & str, const Queue & obj )
+ { return dumpRangeLine( str << "Queue ", obj.begin(), obj.end() ); }
+
+ std::ostream & dumpOn( std::ostream & str, const Queue & obj )
+ {
+ str << "Queue {";
+ if ( ! obj.empty() )
+ {
+ str << endl;
+ for_( it, obj.begin(), obj.end() )
+ str << " " << Solvable(*it) << endl;
+ }
+ return str << "}";
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/sat/Queue.h
+ */
+#ifndef ZYPP_SAT_QUEUE_H
+#define ZYPP_SAT_QUEUE_H
+
+extern "C"
+{
+ struct _Queue;
+}
+#include <iosfwd>
+
+#include "zypp/base/NonCopyable.h"
+#include "zypp/sat/detail/PoolMember.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ { /////////////////////////////////////////////////////////////////
+
+ /** Satsolver Id queue wrapper.
+ */
+ class Queue : private base::NonCopyable
+ {
+ public:
+ typedef unsigned size_type;
+ typedef detail::IdType value_type;
+ typedef const value_type* const_iterator;
+
+ public:
+ /** Default ctor: empty Queue. */
+ Queue();
+
+ /** Dtor */
+ ~Queue();
+
+ bool empty() const;
+ size_type size() const;
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ /** Clear the queue. */
+ void clear();
+
+ /** Push a value to the end off the Queue. */
+ void push( value_type val_r );
+
+ /** Return the 1st Id in the queue or \c 0 if empty. */
+ value_type pop();
+
+ /** Remove and return the 1st Id from the queue or \c 0 if empty. */
+ value_type first() const;
+
+ public:
+ /** Backdoor */
+ operator struct ::_Queue *()
+ { return _pimpl; }
+ /** Backdoor */
+ operator const struct ::_Queue *() const
+ { return _pimpl; }
+
+ private:
+ /** Pointer to implementation */
+ struct ::_Queue * _pimpl;
+ };
+
+ /** \relates Queue Stream output */
+ std::ostream & operator<<( std::ostream & str, const Queue & obj );
+
+ /** \relates Queue Verbose stream output */
+ std::ostream & dumpOn( std::ostream & str, const Queue & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SAT_QUEUE_H