SolutionAction.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * Easy-to use interface to the ZYPP dependency resolver
00004  *
00005  * Author: Stefan Hundhammer <sh@suse.de>
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 
00025 namespace zypp
00026 { 
00027 
00028   namespace solver
00029   { 
00030 
00031     namespace detail
00032     { 
00033 
00037         class SolutionAction : public base::ReferenceCounted
00038         {
00039         protected:
00040             SolutionAction ();
00041         public:
00042             virtual ~SolutionAction();
00043 
00044             // ---------------------------------- I/O
00045             virtual std::ostream & dumpOn( std::ostream & str ) const;
00046             friend std::ostream& operator<<(std::ostream & str, const SolutionAction & action)
00047                 { return action.dumpOn (str); }
00048             friend std::ostream& operator<<(std::ostream & str, const SolutionActionList & actionlist);
00049             friend std::ostream& operator<<(std::ostream & str, const CSolutionActionList & actionlist);
00050 
00051             // ---------------------------------- methods
00056             virtual bool execute (Resolver & resolver) const = 0;
00057         };
00058 
00059 
00065         typedef enum
00066         {
00067             KEEP,
00068             INSTALL,
00069             REMOVE,
00070             UNLOCK,
00071             ALLBRANCHES_ON,
00072             ALLBRANCHES_OFF,        
00073             DOUBLETIMEOUT
00074         } TransactionKind;
00075 
00076 
00077         class TransactionSolutionAction: public SolutionAction
00078         {
00079         public:
00080             TransactionSolutionAction( PoolItem_Ref item,
00081                                        TransactionKind action )
00082                 : SolutionAction(),
00083                   _item( item ), _action( action ) {}
00084 
00085             TransactionSolutionAction( TransactionKind action )
00086                 : SolutionAction(),
00087                   _item(), _action( action ) {}
00088 
00089           // ---------------------------------- I/O
00090           virtual std::ostream & dumpOn( std::ostream & str ) const;
00091           friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
00092                 { return action.dumpOn (str); }
00093 
00094           // ---------------------------------- accessors
00095 
00096           const PoolItem_Ref item() const { return _item; }
00097           const TransactionKind action() const { return _action; }
00098 
00099           // ---------------------------------- methods
00100             virtual bool execute(Resolver & resolver) const;
00101 
00102         protected:
00103 
00104             PoolItem_Ref _item;
00105             const TransactionKind _action;
00106         };
00107 
00108 
00113         typedef enum
00114         {
00115             REQUIRES,
00116             CONFLICTS,
00117             OBSOLETES,
00118             INSTALLED,
00119             ARCHITECTURE,
00120             VENDOR
00121         } InjectSolutionKind;
00122 
00123 
00131         class InjectSolutionAction: public SolutionAction
00132         {
00133         public:
00134 
00135             InjectSolutionAction( PoolItem_Ref item,
00136                                   const Capability & capability,
00137                                   const InjectSolutionKind & kind)
00138                 : SolutionAction(),
00139                   _item( item ), _capability( capability ),
00140                   _kind( kind ), _otherItem() {}
00141 
00142             InjectSolutionAction( PoolItem_Ref item,
00143                                   const InjectSolutionKind & kind)
00144                 : SolutionAction(),
00145                   _item( item ), _capability(),
00146                   _kind( kind ), _otherItem() {}
00147 
00148             InjectSolutionAction( PoolItem_Ref item,
00149                                   const Capability & capability,
00150                                   const InjectSolutionKind & kind,
00151                                   PoolItem_Ref otherItem)
00152                 : SolutionAction(),
00153                   _item( item ), _capability( capability ),
00154                   _kind( kind ), _otherItem( otherItem ) {}
00155 
00156           // ---------------------------------- I/O
00157           virtual std::ostream & dumpOn( std::ostream & str ) const;
00158           friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
00159                 { return action.dumpOn (str); }
00160 
00161           // ---------------------------------- accessors
00162             const Capability & capability() const { return _capability; };
00163             const PoolItem_Ref item() const { return _item; }
00164 
00165           // ---------------------------------- methods
00166             virtual bool execute(Resolver & resolver) const;
00167 
00168         protected:
00169             PoolItem_Ref _item;
00170             const Capability _capability;
00171             const InjectSolutionKind _kind;
00172             PoolItem_Ref _otherItem;
00173         };
00174 
00175 
00177     };// namespace detail
00180   };// namespace solver
00183 };// namespace zypp
00185 
00186 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
00187 

Generated on Tue Sep 25 19:23:08 2007 for libzypp by  doxygen 1.5.3