InstallOrder.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ZYPP_SOLVER_DETAIL_INSTALLORDER_H
00031 #define ZYPP_SOLVER_DETAIL_INSTALLORDER_H
00032
00033 #include <string>
00034 #include <list>
00035 #include <map>
00036 #include <set>
00037
00038 #include "zypp/PoolItem.h"
00039 #include "zypp/ResPool.h"
00040 #include "zypp/Capabilities.h"
00041
00042 #include "zypp/solver/detail/Types.h"
00043
00045 namespace zypp
00046 {
00047
00048 namespace solver
00049 {
00050
00051 namespace detail
00052 {
00053
00062 class InstallOrder
00063 {
00064 private:
00065 const ResPool & _pool;
00066 PoolItemSet _toinstall;
00067 PoolItemSet _installed;
00068
00070 typedef std::map<PoolItem, PoolItemList> Graph;
00071
00073 Graph _graph;
00074
00076 Graph _rgraph;
00077
00078 struct NodeInfo
00079 {
00080 unsigned begintime;
00081 unsigned endtime;
00082 bool visited;
00083 int order;
00084
00085 PoolItem item;
00086
00087 NodeInfo() : begintime(0), endtime(0), visited(false), order(0) {}
00088 NodeInfo(PoolItem item) : begintime(0), endtime(0), visited(false), order(0), item(item) {}
00089 };
00090
00091 typedef std::map<PoolItem, NodeInfo> Nodes;
00092
00093 Nodes _nodes;
00094
00095 unsigned _rdfstime;
00096
00097 PoolItemList _topsorted;
00098
00099 bool _dirty;
00100
00101 unsigned _numrun;
00102
00103 std::set<std::string> _logset;
00104
00105 private:
00106 void rdfsvisit (PoolItem item);
00107
00108 PoolItem findProviderInSet( const Capability requirement, const PoolItemSet & candidates ) const;
00109 bool doesProvide( const Capability requirement, PoolItem item ) const;
00110
00111 public:
00112
00119 InstallOrder( const ResPool & pool, const PoolItemSet & toinstall, const PoolItemSet & installed);
00120
00125 PoolItemList computeNextSet();
00126
00131 void setInstalled( PoolItem item );
00132
00136 void setInstalled( const PoolItemList & list );
00137
00141 void startrdfs();
00142
00147 void init() { startrdfs(); }
00148
00154 const PoolItemList getTopSorted() const;
00155
00156 void printAdj (std::ostream & os, bool reversed = false) const;
00157 };
00158
00160 };
00163 };
00166 };
00168
00169 #endif // ZYPP_SOLVER_DETAIL_INSTALLORDER_H