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>
18
20
22namespace zyppng
23{
25 namespace sat
26 {
27 class Queue;
30
36 class Queue
37 {
38 public:
39 using size_type = unsigned int;
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();
103 { return pop(); }
104
106 void push_front( value_type val_r );
107
110
111 public:
112 operator detail::CQueue *();
113 operator const detail::CQueue *() const
114 { return _pimpl.get(); }
115 private:
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 {
133}
134
135
137#endif // ZYPP_NG_SAT_QUEUE_H
Provides API related macros.
Libsolv Id queue wrapper.
Definition queue.h:37
const value_type * const_iterator
Definition queue.h:41
void push(value_type val_r)
Push a value to the end off the Queue.
Definition queue.cc:109
void remove(value_type val_r)
Remove all occurances of val_r from the queue.
Definition queue.cc:103
value_type last() const
Return the last Id in the queue or 0 if empty.
Definition queue.cc:79
bool contains(value_type val_r) const
Return whether the Queue contais at lest one element with value val_r.
Definition queue.h:59
const_iterator find(value_type val_r) const
Return iterator to the 1st occurance of val_r or end.
Definition queue.cc:64
Queue()
Default ctor: empty Queue.
Definition queue.cc:45
unsigned int size_type
Definition queue.h:39
size_type size() const
Definition queue.cc:55
void pushUnique(value_type val_r)
Push a value if it's not yet in the Queue.
Definition queue.cc:112
detail::IdType value_type
Definition queue.h:40
const_iterator end() const
Definition queue.cc:61
value_type first() const
Return the 1st Id in the queue or 0 if empty.
Definition queue.cc:72
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
const value_type & at(size_type idx_r) const
Return the Id at idx_r in the queue.
Definition queue.cc:88
value_type pop_front()
Pop and return the 1st Id from the queue or 0 if empty.
Definition queue.cc:121
bool empty() const
Definition queue.cc:52
const_iterator begin() const
Definition queue.cc:58
value_type pop_back()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition queue.h:102
void clear()
Clear the queue.
Definition queue.cc:100
zypp::RWCOW_pointer< zypp::sat::detail::CQueue > _pimpl
Pointer to implementation.
Definition queue.h:116
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
value_type pop()
Pop and return the last Id from the queue or 0 if empty.
Definition queue.cc:115
void push_front(value_type val_r)
Push a value to the beginning off the Queue.
Definition queue.cc:118
::s_Queue CQueue
Wrapped libsolv C data type exposed as backdoor.
Definition PoolDefines.h:35
bool operator!=(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
bool operator==(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
Easy-to use interface to the ZYPP dependency resolver.
sat::detail::CQueue * rwcowClone< sat::detail::CQueue >(const sat::detail::CQueue *rhs)
relates: Queue Clone function for RWCOW_pointer
Definition Queue.cc:28
zypp::sat::detail::CQueue CQueue
zypp::sat::detail::IdType IdType
This file contains private API, this might break at any time between releases.
Queue SolvableQueue
Queue with Solvable ids.
Definition queue.h:28
Queue StringQueue
Queue with String ids.
Definition queue.h:29
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469