SolutionAction.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
00010 #define ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
00011
00012 #include <list>
00013 #include <string>
00014
00015 #include "zypp/base/ReferenceCounted.h"
00016 #include "zypp/base/PtrTypes.h"
00017
00018 #include "zypp/Dep.h"
00019 #include "zypp/Capability.h"
00020
00021 #include "zypp/solver/detail/Types.h"
00022 #include "zypp/solver/detail/Resolver.h"
00023 #include "zypp/solver/detail/SolverQueueItem.h"
00024
00026 namespace zypp
00027 {
00028
00029 namespace solver
00030 {
00031
00032 namespace detail
00033 {
00034
00038 class SolutionAction : public base::ReferenceCounted
00039 {
00040 protected:
00041 SolutionAction ();
00042 public:
00043 virtual ~SolutionAction();
00044
00045
00046 virtual std::ostream & dumpOn( std::ostream & str ) const;
00047 friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
00048 { return action.dumpOn (str); }
00049 friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
00050 friend std::ostream& operator<<(std::ostream & str, const CSolutionActionList & actionlist);
00051
00052
00057 virtual bool execute (Resolver & resolver) const = 0;
00058 };
00059
00060
00066 typedef enum
00067 {
00068 KEEP,
00069 INSTALL,
00070 REMOVE,
00071 UNLOCK,
00072 LOCK,
00073 REMOVE_EXTRA_REQUIRE,
00074 REMOVE_EXTRA_CONFLICT,
00075 ADD_SOLVE_QUEUE_ITEM,
00076 REMOVE_SOLVE_QUEUE_ITEM,
00077 } TransactionKind;
00078
00079
00080 class TransactionSolutionAction: public SolutionAction
00081 {
00082 public:
00083 TransactionSolutionAction( PoolItem item,
00084 TransactionKind action )
00085 : SolutionAction(),
00086 _item( item ), _action( action ) {}
00087
00088 TransactionSolutionAction( Capability capability,
00089 TransactionKind action )
00090 : SolutionAction(),
00091 _capability( capability ), _action( action ) {}
00092
00093
00094 TransactionSolutionAction( SolverQueueItem_Ptr item,
00095 TransactionKind action )
00096 : SolutionAction(),
00097 _solverQueueItem( item ), _action( action ) {}
00098
00099 TransactionSolutionAction( TransactionKind action )
00100 : SolutionAction(),
00101 _item(), _action( action ) {}
00102
00103
00104 virtual std::ostream & dumpOn( std::ostream & str ) const;
00105 friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
00106 { return action.dumpOn (str); }
00107
00108
00109
00110 const PoolItem item() const { return _item; }
00111 const Capability capability() const { return _capability; }
00112 TransactionKind action() const { return _action; }
00113
00114
00115 virtual bool execute(Resolver & resolver) const;
00116
00117 protected:
00118
00119 PoolItem _item;
00120 Capability _capability;
00121 SolverQueueItem_Ptr _solverQueueItem;
00122
00123 const TransactionKind _action;
00124 };
00125
00126
00131 typedef enum
00132 {
00133 WEAK
00134 } InjectSolutionKind;
00135
00136
00144 class InjectSolutionAction: public SolutionAction
00145 {
00146 public:
00147
00148 InjectSolutionAction( PoolItem item,
00149 const InjectSolutionKind & kind)
00150 : SolutionAction(),
00151 _item( item ),
00152 _kind( kind ) {}
00153
00154
00155 virtual std::ostream & dumpOn( std::ostream & str ) const;
00156 friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
00157 { return action.dumpOn (str); }
00158
00159
00160 const PoolItem item() const { return _item; }
00161
00162
00163 virtual bool execute(Resolver & resolver) const;
00164
00165 protected:
00166 PoolItem _item;
00167 const InjectSolutionKind _kind;
00168 };
00169
00170
00172 };
00175 };
00178 };
00180
00181 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
00182