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; currently only WEAK
113 } InjectSolutionKind;
117 * A problem solution action that injects an artificial "provides" to
118 * the pool to satisfy open requirements or remove the conflict of
119 * concerning resolvable
121 * This is typically used by "ignore" (user override) solutions.
123 class InjectSolutionAction: public SolutionAction
127 InjectSolutionAction( PoolItem item,
128 const InjectSolutionKind & kind)
133 // ---------------------------------- I/O
134 virtual std::ostream & dumpOn( std::ostream & str ) const;
135 friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
136 { return action.dumpOn (str); }
138 // ---------------------------------- accessors
139 const PoolItem item() const { return _item; }
141 // ---------------------------------- methods
142 virtual bool execute(Resolver & resolver) const;
146 const InjectSolutionKind _kind;
150 ///////////////////////////////////////////////////////////////////
151 };// namespace detail
152 /////////////////////////////////////////////////////////////////////
153 /////////////////////////////////////////////////////////////////////
154 };// namespace solver
155 ///////////////////////////////////////////////////////////////////////
156 ///////////////////////////////////////////////////////////////////////
158 /////////////////////////////////////////////////////////////////////////
160 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H