3 * Easy-to use interface to the ZYPP dependency resolver
5 * Author: Stefan Hundhammer <sh@suse.de>
9 #ifndef ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
10 #define ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
15 #include "zypp/base/ReferenceCounted.h"
16 #include "zypp/base/PtrTypes.h"
19 #include "zypp/Capability.h"
21 #include "zypp/solver/detail/Types.h"
22 #include "zypp/solver/detail/Resolver.h"
24 /////////////////////////////////////////////////////////////////////////
26 { ///////////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////////
30 /////////////////////////////////////////////////////////////////////
32 { ///////////////////////////////////////////////////////////////////
35 * Abstract base class for one action of a problem solution.
37 class SolutionAction : public base::ReferenceCounted
42 virtual ~SolutionAction();
44 // ---------------------------------- I/O
45 virtual std::ostream & dumpOn( std::ostream & str ) const;
46 friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
47 { return action.dumpOn (str); }
48 friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
49 friend std::ostream& operator<<(std::ostream & str, const CSolutionActionList & actionlist);
51 // ---------------------------------- methods
53 * Execute this action.
54 * Returns 'true' on success, 'false' on error.
56 virtual bool execute (Resolver & resolver) const = 0;
61 * A problem solution action that performs a transaction
62 * (installs, removes, keep ...) one resolvable
63 * (package, patch, pattern, product).
74 class TransactionSolutionAction: public SolutionAction
77 TransactionSolutionAction( PoolItem item,
78 TransactionKind action )
80 _item( item ), _action( action ) {}
82 TransactionSolutionAction( TransactionKind action )
84 _item(), _action( action ) {}
86 // ---------------------------------- I/O
87 virtual std::ostream & dumpOn( std::ostream & str ) const;
88 friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
89 { return action.dumpOn (str); }
91 // ---------------------------------- accessors
93 const PoolItem item() const { return _item; }
94 TransactionKind action() const { return _action; }
96 // ---------------------------------- methods
97 virtual bool execute(Resolver & resolver) const;
102 const TransactionKind _action;
107 * Type of ignoring dependencies, architectures and vendor
118 } InjectSolutionKind;
122 * A problem solution action that injects an artificial "provides" to
123 * the pool to satisfy open requirements or remove the conflict of
124 * concerning resolvable
126 * This is typically used by "ignore" (user override) solutions.
128 class InjectSolutionAction: public SolutionAction
132 InjectSolutionAction( PoolItem item,
133 const Capability & capability,
134 const InjectSolutionKind & kind)
136 _item( item ), _capability( capability ),
137 _kind( kind ), _otherItem() {}
139 InjectSolutionAction( PoolItem item,
140 const InjectSolutionKind & kind)
142 _item( item ), _capability(),
143 _kind( kind ), _otherItem() {}
145 InjectSolutionAction( PoolItem item,
146 const Capability & capability,
147 const InjectSolutionKind & kind,
150 _item( item ), _capability( capability ),
151 _kind( kind ), _otherItem( otherItem ) {}
153 // ---------------------------------- I/O
154 virtual std::ostream & dumpOn( std::ostream & str ) const;
155 friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
156 { return action.dumpOn (str); }
158 // ---------------------------------- accessors
159 const Capability & capability() const { return _capability; };
160 const PoolItem item() const { return _item; }
162 // ---------------------------------- methods
163 virtual bool execute(Resolver & resolver) const;
167 const Capability _capability;
168 const InjectSolutionKind _kind;
173 ///////////////////////////////////////////////////////////////////
174 };// namespace detail
175 /////////////////////////////////////////////////////////////////////
176 /////////////////////////////////////////////////////////////////////
177 };// namespace solver
178 ///////////////////////////////////////////////////////////////////////
179 ///////////////////////////////////////////////////////////////////////
181 /////////////////////////////////////////////////////////////////////////
183 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H