libzypp: zypp/ng/sat/queue.h Source File

libzypp 17.38.6

queue.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
11#ifndef ZYPP_NG_SAT_QUEUE_H
12#define ZYPP_NG_SAT_QUEUE_H
13
14#include <iosfwd>
15
16#include <zypp-core/Globals.h>
17#include <zypp-core/base/PtrTypes.h>
18
19#include <zypp/ng/sat/poolconstants.h>
20
22namespace zyppng
23{
25 namespace sat
26 {
27 class Queue;
28 using SolvableQueue = Queue;
29 using StringQueue = Queue;
30
36 class Queue
37 {
38 public:
39 using size_type = unsigned int;
40 using value_type = detail::IdType;
41 using const_iterator = const value_type *;
42
43 public:
45 Queue();
46
48 ~Queue();
49
50 bool empty() const;
51 size_type size() const;
52 const_iterator begin() const;
53 const_iterator end() const;
54
56 const_iterator find( value_type val_r ) const;
57
59 bool contains( value_type val_r ) const
60 { return( find( val_r ) != end() ); }
61
63 value_type first() const;
64
66 value_type last() const;
67
71 const value_type & at( size_type idx_r ) const;
72
76 value_type & at( size_type idx_r );
77
79 const value_type & operator[]( size_type idx_r ) const;
80
82 value_type & operator[]( size_type idx_r );
83
85 void clear();
86
88 void remove( value_type val_r );
89
91 void push( value_type val_r );
93 void push_back( value_type val_r )
94 { push( val_r ); }
95
97 void pushUnique( value_type val_r );
98
100 value_type pop();
102 value_type pop_back()
103 { return pop(); }
104
106 void push_front( value_type val_r );
107
109 value_type pop_front();
110
111 public:
112 operator detail::CQueue *();
113 operator const detail::CQueue *() const
114 { return _pimpl.get(); }
115 private:
116 zypp::RWCOW_pointer<zypp::sat::detail::CQueue> _pimpl;
117 };
118
120 bool operator==( const Queue & lhs, const Queue & rhs );
121
123 inline bool operator!=( const Queue & lhs, const Queue & rhs )
124 { return !( lhs == rhs ); }
125
126 } // namespace sat
128} // namespace zyppng
129
130namespace zypp {
132 template<> sat::detail::CQueue * rwcowClone<sat::detail::CQueue>( const sat::detail::CQueue * rhs );
133}
134
135
137#endif // ZYPP_NG_SAT_QUEUE_H
Globals.h
Provides API related macros.
PtrTypes.h
zyppng::sat::Queue
Libsolv Id queue wrapper.
Definition queue.h:37
zyppng::sat::Queue::~Queue
~Queue()
Dtor.
Definition queue.cc:49
zyppng::sat::Queue::const_iterator
const value_type * const_iterator
Definition queue.h:41
zyppng::sat::Queue::push
void push(value_type val_r)
Push a value to the end off the Queue.
Definition queue.cc:109
zyppng::sat::Queue::remove
void remove(value_type val_r)
Remove all occurances of val_r from the queue.
Definition queue.cc:103
zyppng::sat::Queue::last
value_type last() const
Return the last Id in the queue or 0 if empty.
Definition queue.cc:79
zyppng::sat::Queue::contains
bool contains(value_type val_r) const
Return whether the Queue contais at lest one element with value val_r.
Definition queue.h:59
zyppng::sat::Queue::find
const_iterator find(value_type val_r) const
Return iterator to the 1st occurance of val_r or end.
Definition queue.cc:64
zyppng::sat::Queue::Queue
Queue()
Default ctor: empty Queue.
Definition queue.cc:45
zyppng::sat::Queue::size_type
unsigned int size_type
Definition queue.h:39
zyppng::sat::Queue::size
size_type size() const
Definition queue.cc:55
zyppng::sat::Queue::pushUnique
void pushUnique(value_type val_r)
Push a value if it's not yet in the Queue.
Definition queue.cc:112
zyppng::sat::Queue::value_type
detail::IdType value_type
Definition queue.h:40
zyppng::sat::Queue::end
const_iterator end() const
Definition queue.cc:61
zyppng::sat::Queue::first
value_type first() const
Return the 1st Id in the queue or 0 if empty.
Definition queue.cc:72
zyppng::sat::Queue::operator[]
const value_type & operator[](size_type idx_r) const
Return the Id at idx_r in the queue (no range check).
Definition queue.cc:94
zyppng::sat::Queue::at
const value_type & at(size_type idx_r) const
Return the Id at idx_r in the queue.
Definition queue.cc:88
zyppng::sat::Queue::pop_front
value_type pop_front()
Pop and return the 1st Id from the queue or 0 if empty.
Definition queue.cc:121
zyppng::sat::Queue::empty
bool empty() const
Definition queue.cc:52
zyppng::sat::Queue::begin
const_iterator begin() const
Definition queue.cc:58
zyppng::sat::Queue::pop_back
value_type pop_back()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition queue.h:102
zyppng::sat::Queue::clear
void clear()
Clear the queue.
Definition queue.cc:100
zyppng::sat::Queue::_pimpl
zypp::RWCOW_pointer< zypp::sat::detail::CQueue > _pimpl
Pointer to implementation.
Definition queue.h:116
zyppng::sat::Queue::push_back
void push_back(value_type val_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition queue.h:93
zyppng::sat::Queue::pop
value_type pop()
Pop and return the last Id from the queue or 0 if empty.
Definition queue.cc:115
zyppng::sat::Queue::push_front
void push_front(value_type val_r)
Push a value to the beginning off the Queue.
Definition queue.cc:118
zypp::sat::detail::CQueue
::s_Queue CQueue
Wrapped libsolv C data type exposed as backdoor.
Definition PoolDefines.h:35
zypp::sat::operator!=
bool operator!=(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
Definition FileConflicts.h:89
zypp::sat::operator==
bool operator==(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
Definition FileConflicts.h:85
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::rwcowClone< sat::detail::CQueue >
sat::detail::CQueue * rwcowClone< sat::detail::CQueue >(const sat::detail::CQueue *rhs)
relates: Queue Clone function for RWCOW_pointer
Definition Queue.cc:28
zyppng::sat::detail::CQueue
zypp::sat::detail::CQueue CQueue
Definition poolconstants.h:37
zyppng::sat::detail::IdType
zypp::sat::detail::IdType IdType
Definition poolconstants.h:43
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
zyppng::sat::SolvableQueue
Queue SolvableQueue
Queue with Solvable ids.
Definition queue.h:28
zyppng::sat::StringQueue
Queue StringQueue
Queue with String ids.
Definition queue.h:29
zyppng
Definition MediaNetworkRequestExecutor.h:16
poolconstants.h
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469