libzypp 17.31.23
SolutionAction.h
Go to the documentation of this file.
1/*
2 *
3 * Easy-to use interface to the ZYPP dependency resolver
4 *
5 * Author: Stefan Hundhammer <sh@suse.de>
6 *
7 **/
8
9#ifndef ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
10#define ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
11#ifndef ZYPP_USE_RESOLVER_INTERNALS
12#error Do not directly include this file!
13#else
14
15#include <list>
16#include <string>
17
18#include <zypp/base/ReferenceCounted.h>
19#include <zypp/base/PtrTypes.h>
20
21#include <zypp/PoolItem.h>
22
24namespace zypp
25{
27 namespace solver
28 {
30 namespace detail
31 {
32
33 class Resolver;
34
36
37 DEFINE_PTR_TYPE(SolutionAction);
38 typedef std::list<SolutionAction_Ptr> SolutionActionList;
39
43 class SolutionAction : public base::ReferenceCounted
44 {
45 protected:
46 typedef Resolver ResolverInternal;
47 SolutionAction ();
48 public:
49 virtual ~SolutionAction();
50
51 // ---------------------------------- I/O
52 virtual std::ostream & dumpOn( std::ostream & str ) const;
53 friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
54 { return action.dumpOn (str); }
55 friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
56
57 // ---------------------------------- methods
62 virtual bool execute (ResolverInternal & resolver) const = 0;
63 };
64
65
71 typedef enum
72 {
73 KEEP,
74 INSTALL,
75 REMOVE,
76 UNLOCK,
77 LOCK,
78 REMOVE_EXTRA_REQUIRE,
79 REMOVE_EXTRA_CONFLICT,
80 ADD_SOLVE_QUEUE_ITEM,
81 REMOVE_SOLVE_QUEUE_ITEM,
82 } TransactionKind;
83
84
85 class TransactionSolutionAction: public SolutionAction
86 {
87 public:
88 TransactionSolutionAction( PoolItem item,
89 TransactionKind action )
90 : SolutionAction(),
91 _item( item ), _action( action ) {}
92
93 TransactionSolutionAction( Capability capability,
94 TransactionKind action )
95 : SolutionAction(),
96 _capability( capability ), _action( action ) {}
97
98
99 TransactionSolutionAction( SolverQueueItem_Ptr item,
100 TransactionKind action )
101 : SolutionAction(),
102 _solverQueueItem( item ), _action( action ) {}
103
104 TransactionSolutionAction( TransactionKind action )
105 : SolutionAction(),
106 _item(), _action( action ) {}
107
108 // ---------------------------------- I/O
109 virtual std::ostream & dumpOn( std::ostream & str ) const;
110 friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
111 { return action.dumpOn (str); }
112
113 // ---------------------------------- accessors
114
115 const PoolItem item() const { return _item; }
116 const Capability capability() const { return _capability; }
117 TransactionKind action() const { return _action; }
118
119 // ---------------------------------- methods
120 virtual bool execute(ResolverInternal & resolver) const;
121
122 protected:
123
124 PoolItem _item;
125 Capability _capability;
126 SolverQueueItem_Ptr _solverQueueItem;
127
128 const TransactionKind _action;
129 };
130
131
136 typedef enum
137 {
138 WEAK
139 } InjectSolutionKind;
140
141
149 class InjectSolutionAction: public SolutionAction
150 {
151 public:
152
153 InjectSolutionAction( PoolItem item,
154 const InjectSolutionKind & kind)
155 : SolutionAction(),
156 _item( item ),
157 _kind( kind ) {}
158
159 // ---------------------------------- I/O
160 virtual std::ostream & dumpOn( std::ostream & str ) const;
161 friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
162 { return action.dumpOn (str); }
163
164 // ---------------------------------- accessors
165 const PoolItem item() const { return _item; }
166
167 // ---------------------------------- methods
168 virtual bool execute(ResolverInternal & resolver) const;
169
170 protected:
171 PoolItem _item;
172 const InjectSolutionKind _kind;
173 };
174
175
177 };// namespace detail
180 };// namespace solver
183};// namespace zypp
185#endif // ZYPP_USE_RESOLVER_INTERNALS
186#endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
187
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
Definition: LookupAttr.cc:807
String related utilities and Regular expression matching.
Resolver ResolverInternal
Preferred name in API.
Definition: Types.h:39
std::list< SolutionAction_Ptr > SolutionActionList
Definition: Types.h:48
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:580
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition: PtrTypes.h:623