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"
23 #include "zypp/solver/detail/SolverQueueItem.h"
25 /////////////////////////////////////////////////////////////////////////
27 { ///////////////////////////////////////////////////////////////////////
28 ///////////////////////////////////////////////////////////////////////
30 { /////////////////////////////////////////////////////////////////////
31 /////////////////////////////////////////////////////////////////////
33 { ///////////////////////////////////////////////////////////////////
36 * Abstract base class for one action of a problem solution.
38 class SolutionAction : public base::ReferenceCounted
43 virtual ~SolutionAction();
45 // ---------------------------------- I/O
46 virtual std::ostream & dumpOn( std::ostream & str ) const;
47 friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
48 { return action.dumpOn (str); }
49 friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
50 friend std::ostream& operator<<(std::ostream & str, const CSolutionActionList & actionlist);
52 // ---------------------------------- methods
54 * Execute this action.
55 * Returns 'true' on success, 'false' on error.
57 virtual bool execute (Resolver & resolver) const = 0;
62 * A problem solution action that performs a transaction
63 * (installs, removes, keep ...) one resolvable
64 * (package, patch, pattern, product).
74 REMOVE_EXTRA_CONFLICT,
76 REMOVE_SOLVE_QUEUE_ITEM,
80 class TransactionSolutionAction: public SolutionAction
83 TransactionSolutionAction( PoolItem item,
84 TransactionKind action )
86 _item( item ), _action( action ) {}
88 TransactionSolutionAction( Capability capability,
89 TransactionKind action )
91 _capability( capability ), _action( action ) {}
94 TransactionSolutionAction( SolverQueueItem_Ptr item,
95 TransactionKind action )
97 _solverQueueItem( item ), _action( action ) {}
99 TransactionSolutionAction( TransactionKind action )
101 _item(), _action( action ) {}
103 // ---------------------------------- I/O
104 virtual std::ostream & dumpOn( std::ostream & str ) const;
105 friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
106 { return action.dumpOn (str); }
108 // ---------------------------------- accessors
110 const PoolItem item() const { return _item; }
111 const Capability capability() const { return _capability; }
112 TransactionKind action() const { return _action; }
114 // ---------------------------------- methods
115 virtual bool execute(Resolver & resolver) const;
120 Capability _capability;
121 SolverQueueItem_Ptr _solverQueueItem;
123 const TransactionKind _action;
128 * Type of ignoring; currently only WEAK
134 } InjectSolutionKind;
138 * A problem solution action that injects an artificial "provides" to
139 * the pool to satisfy open requirements or remove the conflict of
140 * concerning resolvable
142 * This is typically used by "ignore" (user override) solutions.
144 class InjectSolutionAction: public SolutionAction
148 InjectSolutionAction( PoolItem item,
149 const InjectSolutionKind & kind)
154 // ---------------------------------- I/O
155 virtual std::ostream & dumpOn( std::ostream & str ) const;
156 friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
157 { return action.dumpOn (str); }
159 // ---------------------------------- accessors
160 const PoolItem item() const { return _item; }
162 // ---------------------------------- methods
163 virtual bool execute(Resolver & resolver) const;
167 const InjectSolutionKind _kind;
171 ///////////////////////////////////////////////////////////////////
172 };// namespace detail
173 /////////////////////////////////////////////////////////////////////
174 /////////////////////////////////////////////////////////////////////
175 };// namespace solver
176 ///////////////////////////////////////////////////////////////////////
177 ///////////////////////////////////////////////////////////////////////
179 /////////////////////////////////////////////////////////////////////////
181 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H