libzypp: zypp/sat/Queue.h Source File

libzypp 17.38.14

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-core/Globals.h>
17#include <zypp-core/base/PtrTypes.h>
18#include <zypp/sat/detail/PoolDefines.h>
19
21namespace zypp
22{
24 namespace sat
25 {
26 class Queue;
27 using SolvableQueue = Queue;
28 using StringQueue = Queue;
29
35 class ZYPP_API Queue
36 {
37 public:
38 using size_type = unsigned int;
39 using value_type = detail::IdType;
40 using const_iterator = const value_type *;
41
42 public:
44 Queue();
45
47 ~Queue();
48
49 bool empty() const;
50 size_type size() const;
51 const_iterator begin() const;
52 const_iterator end() const;
53
55 const_iterator find( value_type val_r ) const;
56
58 bool contains( value_type val_r ) const
59 { return( find( val_r ) != end() ); }
60
62 value_type first() const;
63
65 value_type last() const;
66
70 const value_type & at( size_type idx_r ) const;
71
75 value_type & at( size_type idx_r );
76
78 const value_type & operator[]( size_type idx_r ) const;
79
81 value_type & operator[]( size_type idx_r );
82
84 void clear();
85
87 void remove( value_type val_r );
88
90 void push( value_type val_r );
92 void push_back( value_type val_r )
93 { push( val_r ); }
94
96 void pushUnique( value_type val_r );
97
99 value_type pop();
101 value_type pop_back()
102 { return pop(); }
103
105 void push_front( value_type val_r );
106
108 value_type pop_front();
109
110 public:
111 operator detail::CQueue *();
112 operator const detail::CQueue *() const
113 { return _pimpl.get(); }
114 private:
115 RWCOW_pointer<detail::CQueue> _pimpl;
116 };
117
119 std::ostream & operator<<( std::ostream & str, const Queue & obj ) ZYPP_API;
120
122 std::ostream & dumpOn( std::ostream & str, const Queue & obj ) ZYPP_API;
123
125 bool operator==( const Queue & lhs, const Queue & rhs ) ZYPP_API;
126
128 inline bool operator!=( const Queue & lhs, const Queue & rhs )
129 { return !( lhs == rhs ); }
130
131 } // namespace sat
133
135 template<> sat::detail::CQueue * rwcowClone<sat::detail::CQueue>( const sat::detail::CQueue * rhs );
136
137} // namespace zypp
139#endif // ZYPP_SAT_QUEUE_H
Globals.h
Provides API related macros.
PoolDefines.h
PtrTypes.h
zypp::sat::Queue
Libsolv Id queue wrapper.
Definition Queue.h:36
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::value_type
detail::IdType value_type
Definition Queue.h:39
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:92
zypp::sat::Queue::_pimpl
RWCOW_pointer< detail::CQueue > _pimpl
Pointer to implementation.
Definition Queue.h:115
zypp::sat::Queue::size_type
unsigned int size_type
Definition Queue.h:38
zypp::sat::Queue::const_iterator
const value_type * const_iterator
Definition Queue.h:40
zypp::sat::Queue::size
size_type size() const
Definition Queue.cc:49
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:101
zypp::sat::Queue::end
const_iterator end() const
Definition Queue.cc:55
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::empty
bool empty() const
Definition Queue.cc:46
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::contains
bool contains(value_type val_r) const
Return whether the Queue contais at lest one element with value val_r.
Definition Queue.h:58
str
String related utilities and Regular expression matching.
zypp::sat::detail::IdType
int IdType
Generic Id type.
Definition PoolDefines.h:42
zypp::sat::detail::CQueue
::s_Queue CQueue
Wrapped libsolv C data type exposed as backdoor.
Definition PoolDefines.h:35
zypp::sat
Libsolv interface
zypp::sat::operator<<
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
relates: FileConflicts Stream output
Definition FileConflicts.cc:109
zypp::sat::operator!=
bool operator!=(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
Definition FileConflicts.h:89
zypp::sat::SolvableQueue
Queue SolvableQueue
Queue with Solvable ids.
Definition Queue.h:27
zypp::sat::operator==
bool operator==(const FileConflicts &lhs, const FileConflicts &rhs)
relates: FileConflicts
Definition FileConflicts.h:85
zypp::sat::StringQueue
Queue StringQueue
Queue with String ids.
Definition Queue.h:28
zypp::sat::dumpOn
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
relates: LocaleSupport More verbose stream output including dependencies
Definition LocaleSupport.cc:41
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
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
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469