SolverQueueItemUpdate.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/solver/detail/SolverQueueItemUpdate.h"
00027
00029 namespace zypp
00030 {
00031
00032 namespace solver
00033 {
00034
00035 namespace detail
00036 {
00037
00038 using namespace std;
00039
00040 IMPL_PTR_TYPE(SolverQueueItemUpdate);
00041
00042
00043
00044 std::ostream &
00045 SolverQueueItemUpdate::dumpOn( std::ostream & os ) const
00046 {
00047 os << "[" << (_soft?"Soft":"") << "Update: " <<
00048 _item << "]";
00049
00050 return os;
00051 }
00052
00053
00054
00055 SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool,
00056 const PoolItem & item, bool soft)
00057 : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool)
00058 , _item (item)
00059 , _soft (soft)
00060 {
00061 }
00062
00063
00064 SolverQueueItemUpdate::~SolverQueueItemUpdate()
00065 {
00066 }
00067
00068
00069
00070 bool SolverQueueItemUpdate::addRule (_Queue & q)
00071 {
00072 ::Id id = _item.satSolvable().id();
00073 if (id == ID_NULL) {
00074 ERR << "Update explicit: " << _item << " not found" << endl;
00075 return false;
00076 }
00077 MIL << "Update explicit " << _item << " with the SAT-Pool ID: " << id << endl;
00078 queue_push( &(q), SOLVER_UPDATE | SOLVER_SOLVABLE );
00079 queue_push( &(q), id );
00080 return true;
00081 }
00082
00083 SolverQueueItem_Ptr
00084 SolverQueueItemUpdate::copy (void) const
00085 {
00086 SolverQueueItemUpdate_Ptr new_update = new SolverQueueItemUpdate (pool(), _item);
00087 new_update->SolverQueueItem::copy(this);
00088
00089 new_update->_soft = _soft;
00090 return new_update;
00091 }
00092
00093 int
00094 SolverQueueItemUpdate::cmp (SolverQueueItem_constPtr item) const
00095 {
00096 int cmp = this->compare (item);
00097 if (cmp != 0)
00098 return cmp;
00099 SolverQueueItemUpdate_constPtr update = dynamic_pointer_cast<const SolverQueueItemUpdate>(item);
00100 return compareByNVRA (_item.resolvable(), update->_item.resolvable());
00101 }
00102
00103
00104
00105
00106
00108 };
00111 };
00114 };