libzypp: zypp/sat/Queue.h Source File

libzypp 17.25.10

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 #include <iosfwd>
15
16 #include <zypp/base/PtrTypes.h>
17 #include <zypp/sat/detail/PoolMember.h>
18
20 namespace zypp
21 {
23 namespace sat
24 {
25 class Queue;
26 typedef Queue SolvableQueue;
27 typedef Queue StringQueue;
28
34 class Queue
35 {
36 public:
37 typedef unsigned size_type;
38 typedef detail::IdType value_type;
39 typedef const value_type* const_iterator;
40
41 public:
43 Queue();
44
46 ~Queue();
47
48 bool empty() const;
49 size_type size() const;
50 const_iterator begin() const;
51 const_iterator end() const;
52
54 const_iterator find( value_type val_r ) const;
55
57 bool contains( value_type val_r ) const
58 { return( find( val_r ) != end() ); }
59
61 value_type first() const;
62
64 value_type last() const;
65
69 const value_type & at( size_type idx_r ) const;
70
74 value_type & at( size_type idx_r );
75
77 const value_type & operator[]( size_type idx_r ) const;
78
80 value_type & operator[]( size_type idx_r );
81
83 void clear();
84
86 void remove( value_type val_r );
87
89 void push( value_type val_r );
91 void push_back( value_type val_r )
92 { push( val_r ); }
93
95 void pushUnique( value_type val_r );
96
98 value_type pop();
100 value_type pop_back()
101 { return pop(); }
102
104 void push_front( value_type val_r );
105
107 value_type pop_front();
108
109 public:
110 operator detail::CQueue *();
111 operator const detail::CQueue *() const
112 { return _pimpl.get(); }
113 private:
114 RWCOW_pointer<detail::CQueue> _pimpl;
115 };
116
118 std::ostream & operator<<( std::ostream & str, const Queue & obj );
119
121 std::ostream & dumpOn( std::ostream & str, const Queue & obj );
122
124 bool operator==( const Queue & lhs, const Queue & rhs );
125
127 inline bool operator!=( const Queue & lhs, const Queue & rhs )
128 { return !( lhs == rhs ); }
129
130 } // namespace sat
132
134 template<> sat::detail::CQueue * rwcowClone<sat::detail::CQueue>( const sat::detail::CQueue * rhs );
135
136 } // namespace zypp
138 #endif // ZYPP_SAT_QUEUE_H
PoolMember.h
PtrTypes.h
zypp::sat::Queue
Libsolv Id queue wrapper.
Definition: Queue.h:35
zypp::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:58
zypp::sat::Queue::pop_front
value_type pop_front()
Pop and return the 1st Id from the queue or 0 if empty.
Definition: Queue.cc:115
zypp::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:91
zypp::sat::Queue::_pimpl
RWCOW_pointer< detail::CQueue > _pimpl
Pointer to implementation.
Definition: Queue.h:114
zypp::sat::Queue::remove
void remove(value_type val_r)
Remove all occurances of val_r from the queue.
Definition: Queue.cc:97
zypp::sat::Queue::first
value_type first() const
Return the 1st Id in the queue or 0 if empty.
Definition: Queue.cc:66
zypp::sat::Queue::push_front
void push_front(value_type val_r)
Push a value to the beginning off the Queue.
Definition: Queue.cc:112
zypp::sat::Queue::~Queue
~Queue()
Dtor.
Definition: Queue.cc:43
zypp::sat::Queue::size
size_type size() const
Definition: Queue.cc:49
zypp::sat::Queue::last
value_type last() const
Return the last Id in the queue or 0 if empty.
Definition: Queue.cc:73
zypp::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:100
zypp::sat::Queue::end
const_iterator end() const
Definition: Queue.cc:55
zypp::sat::Queue::const_iterator
const value_type * const_iterator
Definition: Queue.h:39
zypp::sat::Queue::Queue
Queue()
Default ctor: empty Queue.
Definition: Queue.cc:39
zypp::sat::Queue::begin
const_iterator begin() const
Definition: Queue.cc:52
zypp::sat::Queue::pop
value_type pop()
Pop and return the last Id from the queue or 0 if empty.
Definition: Queue.cc:109
zypp::sat::Queue::value_type
detail::IdType value_type
Definition: Queue.h:38
zypp::sat::Queue::clear
void clear()
Clear the queue.
Definition: Queue.cc:94
zypp::sat::Queue::size_type
unsigned size_type
Definition: Queue.h:37
zypp::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:88
zypp::sat::Queue::at
const value_type & at(size_type idx_r) const
Return the Id at idx_r in the queue.
Definition: Queue.cc:82
zypp::sat::Queue::empty
bool empty() const
Definition: Queue.cc:46
zypp::sat::Queue::operator!=
bool operator!=(const Queue &lhs, const Queue &rhs)
Definition: Queue.h:127
zypp::sat::Queue::push
void push(value_type val_r)
Push a value to the end off the Queue.
Definition: Queue.cc:103
zypp::sat::Queue::pushUnique
void pushUnique(value_type val_r)
Push a value if it's not yet in the Queue.
Definition: Queue.cc:106
zypp::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:57
str
String related utilities and Regular expression matching.
zypp::sat::detail::CQueue
::s_Queue CQueue
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:62
zypp::sat::detail::IdType
int IdType
Generic Id type.
Definition: PoolMember.h:104
zypp::sat::dumpOn
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
Definition: LocaleSupport.cc:41
zypp::sat::SolvableQueue
Queue SolvableQueue
Queue with Solvable ids.
Definition: Queue.h:25
zypp::sat::StringQueue
Queue StringQueue
Queue with String ids.
Definition: Queue.h:27
zypp::sat::operator<<
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
Definition: FileConflicts.cc:109
zypp::sat::operator==
bool operator==(const Map &lhs, const Map &rhs)
Definition: Map.cc:125
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition: PtrTypes.h:459