SolverQueueItemInstall.cc
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 extern "C"
00021 {
00022 #include <satsolver/solver.h>
00023 }
00024
00025 #include "zypp/base/Logger.h"
00026 #include "zypp/IdString.h"
00027 #include "zypp/IdStringType.h"
00028 #include "zypp/solver/detail/SolverQueueItemInstall.h"
00029
00031 namespace zypp
00032 {
00033
00034 namespace solver
00035 {
00036
00037 namespace detail
00038 {
00039
00040 using namespace std;
00041
00042 IMPL_PTR_TYPE(SolverQueueItemInstall);
00043
00044
00045
00046 std::ostream &
00047 SolverQueueItemInstall::dumpOn( std::ostream & os ) const
00048 {
00049 os << "[" << (_soft?"Soft":"") << "Install: "
00050 << _name
00051 << "]";
00052
00053 return os;
00054 }
00055
00056
00057
00058 SolverQueueItemInstall::SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft)
00059 : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL, pool)
00060 , _name (name)
00061 , _soft (soft)
00062 {
00063 }
00064
00065
00066 SolverQueueItemInstall::~SolverQueueItemInstall()
00067 {
00068 }
00069
00070
00071
00072 bool SolverQueueItemInstall::addRule (_Queue & q)
00073 {
00074 ::Id id = IdString(_name).id();
00075 if (_soft) {
00076 queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_WEAK );
00077 } else {
00078 queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME );
00079 }
00080 queue_push( &(q), id);
00081
00082 MIL << "Install " << _name << (_soft ? "(soft)" : "")
00083 << " with SAT-PoolID: " << id << endl;
00084 return true;
00085 }
00086
00087 SolverQueueItem_Ptr
00088 SolverQueueItemInstall::copy (void) const
00089 {
00090 SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name);
00091 new_install->SolverQueueItem::copy(this);
00092
00093 new_install->_soft = _soft;
00094 return new_install;
00095 }
00096
00097 int
00098 SolverQueueItemInstall::cmp (SolverQueueItem_constPtr item) const
00099 {
00100 int cmp = this->compare (item);
00101 if (cmp != 0)
00102 return cmp;
00103 SolverQueueItemInstall_constPtr ins = dynamic_pointer_cast<const SolverQueueItemInstall>(item);
00104 if (_name != ins->_name) {
00105 return _name.compare(ins->_name);
00106 }
00107 return 0;
00108 }
00109
00110
00111
00112
00113
00115 };
00118 };
00121 };