SolutionAction.h

Go to the documentation of this file.
00001 
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         } TransactionKind;
00072         
00073         
00074         class TransactionSolutionAction: public SolutionAction
00075         {
00076         public:
00077             TransactionSolutionAction( PoolItem_Ref item,
00078                                        TransactionKind action )
00079                 : SolutionAction(),
00080                   _item( item ), _action( action ) {}
00081 
00082           // ---------------------------------- I/O
00083           virtual std::ostream & dumpOn( std::ostream & str ) const;
00084           friend std::ostream& operator<<(std::ostream& str, const TransactionSolutionAction & action)
00085                 { return action.dumpOn (str); }
00086 
00087           // ---------------------------------- accessors
00088 
00089           const PoolItem_Ref item() const { return _item; }
00090           const TransactionKind action() const { return _action; }
00091 
00092           // ---------------------------------- methods
00093             virtual bool execute(Resolver & resolver) const;
00094 
00095         protected:
00096 
00097             PoolItem_Ref _item;
00098             const TransactionKind _action;
00099         };
00100 
00101 
00106         typedef enum
00107         {
00108             REQUIRES,
00109             CONFLICTS,
00110             OBSOLETES,
00111             INSTALLED,
00112             ARCHITECTURE
00113         } InjectSolutionKind;
00114         
00115 
00123         class InjectSolutionAction: public SolutionAction
00124         {
00125         public:
00126 
00127             InjectSolutionAction( PoolItem_Ref item,
00128                                   const Capability & capability,
00129                                   const InjectSolutionKind & kind)
00130                 : SolutionAction(),
00131                   _item( item ), _capability( capability ),
00132                   _kind( kind ), _otherItem() {}
00133             
00134             InjectSolutionAction( PoolItem_Ref item,
00135                                   const InjectSolutionKind & kind)
00136                 : SolutionAction(),
00137                   _item( item ), _capability(),
00138                   _kind( kind ), _otherItem() {}
00139             
00140             InjectSolutionAction( PoolItem_Ref item,
00141                                   const Capability & capability,
00142                                   const InjectSolutionKind & kind,
00143                                   PoolItem_Ref otherItem)
00144                 : SolutionAction(),
00145                   _item( item ), _capability( capability ),
00146                   _kind( kind ), _otherItem( otherItem ) {}
00147 
00148           // ---------------------------------- I/O
00149           virtual std::ostream & dumpOn( std::ostream & str ) const;
00150           friend std::ostream& operator<<(std::ostream& str, const InjectSolutionAction & action)
00151                 { return action.dumpOn (str); }       
00152 
00153           // ---------------------------------- accessors
00154             const Capability & capability() const { return _capability; };
00155             const PoolItem_Ref item() const { return _item; }       
00156 
00157           // ---------------------------------- methods
00158             virtual bool execute(Resolver & resolver) const;
00159 
00160         protected:
00161             PoolItem_Ref _item;
00162             const Capability _capability;
00163             const InjectSolutionKind _kind;
00164             PoolItem_Ref _otherItem;        
00165         };
00166 
00167 
00169     };// namespace detail
00172   };// namespace solver
00175 };// namespace zypp
00177 
00178 #endif // ZYPP_SOLVER_DETAIL_SOLUTIONACTION_H
00179 

Generated on Thu Jul 6 00:07:23 2006 for zypp by  doxygen 1.4.6