added new solver request
authorStefan Schubert <schubi@suse.de>
Mon, 14 Apr 2008 17:33:35 +0000 (17:33 +0000)
committerStefan Schubert <schubi@suse.de>
Mon, 14 Apr 2008 17:33:35 +0000 (17:33 +0000)
zypp/CMakeLists.txt
zypp/sat/SolverQueueItem.cc
zypp/sat/SolverQueueItem.h
zypp/sat/SolverQueueItemDelete.cc [new file with mode: 0644]
zypp/sat/SolverQueueItemDelete.h [new file with mode: 0644]
zypp/sat/SolverQueueItemInstall.cc [new file with mode: 0644]
zypp/sat/SolverQueueItemInstall.h [new file with mode: 0644]
zypp/sat/SolverQueueItemInstallOneOf.cc [new file with mode: 0644]
zypp/sat/SolverQueueItemInstallOneOf.h [new file with mode: 0644]
zypp/sat/SolverQueueItemUpdate.cc [new file with mode: 0644]
zypp/sat/SolverQueueItemUpdate.h [new file with mode: 0644]

index 6f05cf7..34203ef 100644 (file)
@@ -522,6 +522,10 @@ SET( zypp_sat_SRCS
   sat/SATResolver.cc
   sat/SolvAttr.cc
   sat/SolverQueueItem.cc
+  sat/SolverQueueItemInstall.cc
+  sat/SolverQueueItemDelete.cc
+  sat/SolverQueueItemUpdate.cc
+  sat/SolverQueueItemInstallOneOf.cc
 )
 
 SET( zypp_sat_HEADERS
@@ -534,6 +538,10 @@ SET( zypp_sat_HEADERS
   sat/LookupAttr.h
   sat/SATResolver.h
   sat/SolverQueueItem.h
+  sat/SolverQueueItemInstall.h
+  sat/SolverQueueItemDelete.h
+  sat/SolverQueueItemUpdate.h
+  sat/SolverQueueItemInstallOneOf.h
   sat/SolvAttr.h
 )
 
index 85ad648..338eed3 100644 (file)
@@ -44,8 +44,8 @@ SolverQueueItem::dumpOn( std::ostream & os ) const
     switch (_type) {
       case QUEUE_ITEM_TYPE_UNKNOWN       :     os << "unknown"; break;
       case QUEUE_ITEM_TYPE_UPDATE        :     os << "update"; break;    
-      case QUEUE_ITEM_TYPE_REQUIRE       :     os << "require"; break;
-      case QUEUE_ITEM_TYPE_CONFLICT      :     os << "conflict"; break;
+      case QUEUE_ITEM_TYPE_INSTALL       :     os << "install"; break;
+      case QUEUE_ITEM_TYPE_DELETE      :       os << "delete"; break;
       case QUEUE_ITEM_TYPE_INSTALL_ONE_OF:     os << "install one of"; break;    
       default: os << "?solverqueueitem?"; break;
     }
index e143344..2f9ee4c 100644 (file)
 #include "zypp/base/ReferenceCounted.h"
 #include "zypp/base/NonCopyable.h"
 #include "zypp/base/PtrTypes.h"
-
 #include "zypp/ResPool.h"
 
-
 /////////////////////////////////////////////////////////////////////////
 namespace zypp
 { ///////////////////////////////////////////////////////////////////////
@@ -45,8 +43,8 @@ namespace zypp
 typedef enum {
     QUEUE_ITEM_TYPE_UNKNOWN = 0,
     QUEUE_ITEM_TYPE_UPDATE,    
-    QUEUE_ITEM_TYPE_REQUIRE,
-    QUEUE_ITEM_TYPE_CONFLICT,
+    QUEUE_ITEM_TYPE_INSTALL,
+    QUEUE_ITEM_TYPE_DELETE,
     QUEUE_ITEM_TYPE_INSTALL_ONE_OF,    
 } SolverQueueItemType;
 
@@ -91,8 +89,8 @@ class SolverQueueItem : public base::ReferenceCounted, private base::NonCopyable
 
     void copy (const SolverQueueItem *from);
 
-    bool isConflict (void) const { return _type == QUEUE_ITEM_TYPE_CONFLICT; }
-    bool isRequire (void) const { return _type == QUEUE_ITEM_TYPE_REQUIRE; }
+    bool isDelete (void) const { return _type == QUEUE_ITEM_TYPE_DELETE; }
+    bool isInstall (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL; }
     bool isUpdate (void) const { return _type == QUEUE_ITEM_TYPE_UPDATE; }
     bool isInstallOneOf (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL_ONE_OF; }    
 
diff --git a/zypp/sat/SolverQueueItemDelete.cc b/zypp/sat/SolverQueueItemDelete.cc
new file mode 100644 (file)
index 0000000..61674e4
--- /dev/null
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* SolverQueueItem.cc
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "zypp/base/Logger.h"
+#include "zypp/sat/SolverQueueItemDelete.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp 
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+IMPL_PTR_TYPE(SolverQueueItemDelete);
+
+//---------------------------------------------------------------------------
+
+std::ostream &
+SolverQueueItemDelete::dumpOn( std::ostream & os ) const
+{
+    os << "[" << (_soft?"Soft":"") << "Delete: ";
+    os << _name;
+
+    return os;
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItemDelete::SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft)
+    : SolverQueueItem (QUEUE_ITEM_TYPE_DELETE, pool)
+    , _name (name)
+    , _soft (soft)
+{
+}
+
+
+SolverQueueItemDelete::~SolverQueueItemDelete()
+{
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItem_Ptr
+SolverQueueItemDelete::copy (void) const
+{
+    SolverQueueItemDelete_Ptr new_delete = new SolverQueueItemDelete (pool(), _name);
+    new_delete->SolverQueueItem::copy(this);
+
+    new_delete->_soft = _soft;
+    return new_delete;
+}
+
+
+//---------------------------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
diff --git a/zypp/sat/SolverQueueItemDelete.h b/zypp/sat/SolverQueueItemDelete.h
new file mode 100644 (file)
index 0000000..5ae629d
--- /dev/null
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* QueueItem.h
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H
+#define ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/sat/SolverQueueItem.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+DEFINE_PTR_TYPE(SolverQueueItemDelete);
+       
+
+///////////////////////////////////////////////////////////////////
+//
+//     CLASS NAME : SolverQueueItemDelete
+
+class SolverQueueItemDelete : public SolverQueueItem {
+    
+  private:
+
+    std::string _name;
+    bool _soft;          // if triggered by a soft requirement (a recommends)
+
+  public:
+
+    SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft = false);
+    virtual ~SolverQueueItemDelete();
+    
+    // ---------------------------------- I/O
+
+    virtual std::ostream & dumpOn( std::ostream & str ) const;
+
+    friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemDelete & obj)
+    { return obj.dumpOn (str); }
+
+    // ---------------------------------- accessors
+
+    bool isSoft (void) const { return _soft; }    
+
+    // ---------------------------------- methods
+
+    virtual SolverQueueItem_Ptr copy (void) const;
+    virtual int cmp (SolverQueueItem_constPtr item) const;
+};
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
+#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H
diff --git a/zypp/sat/SolverQueueItemInstall.cc b/zypp/sat/SolverQueueItemInstall.cc
new file mode 100644 (file)
index 0000000..b54e5bb
--- /dev/null
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* SolverQueueItem.cc
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "zypp/base/Logger.h"
+#include "zypp/sat/SolverQueueItemInstall.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp 
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+IMPL_PTR_TYPE(SolverQueueItemInstall);
+
+//---------------------------------------------------------------------------
+
+std::ostream &
+SolverQueueItemInstall::dumpOn( std::ostream & os ) const
+{
+    os << "[" << (_soft?"Soft":"") << "Install: ";
+    os << _name;
+
+    return os;
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItemInstall::SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft)
+    : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL, pool)
+    , _name (name)
+    , _soft (soft)
+{
+}
+
+
+SolverQueueItemInstall::~SolverQueueItemInstall()
+{
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItem_Ptr
+SolverQueueItemInstall::copy (void) const
+{
+    SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name);
+    new_install->SolverQueueItem::copy(this);
+
+    new_install->_soft = _soft;
+    return new_install;
+}
+
+
+//---------------------------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
diff --git a/zypp/sat/SolverQueueItemInstall.h b/zypp/sat/SolverQueueItemInstall.h
new file mode 100644 (file)
index 0000000..1a954de
--- /dev/null
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* QueueItem.h
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H
+#define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/sat/SolverQueueItem.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+DEFINE_PTR_TYPE(SolverQueueItemInstall);
+       
+
+///////////////////////////////////////////////////////////////////
+//
+//     CLASS NAME : SolverQueueItemInstall
+
+class SolverQueueItemInstall : public SolverQueueItem {
+    
+  private:
+
+    std::string _name;
+    bool _soft;          // if triggered by a soft requirement (a recommends)
+
+  public:
+
+    SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft = false);
+    virtual ~SolverQueueItemInstall();
+    
+    // ---------------------------------- I/O
+
+    virtual std::ostream & dumpOn( std::ostream & str ) const;
+
+    friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstall & obj)
+    { return obj.dumpOn (str); }
+
+    // ---------------------------------- accessors
+
+    bool isSoft (void) const { return _soft; }    
+
+    // ---------------------------------- methods
+
+    virtual SolverQueueItem_Ptr copy (void) const;
+    virtual int cmp (SolverQueueItem_constPtr item) const;
+};
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
+#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H
diff --git a/zypp/sat/SolverQueueItemInstallOneOf.cc b/zypp/sat/SolverQueueItemInstallOneOf.cc
new file mode 100644 (file)
index 0000000..58a3de1
--- /dev/null
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* SolverQueueItem.cc
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "zypp/base/Logger.h"
+#include "zypp/sat/SolverQueueItemInstallOneOf.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp 
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+IMPL_PTR_TYPE(SolverQueueItemInstallOneOf);
+
+//---------------------------------------------------------------------------
+
+std::ostream &
+SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const
+{
+    os << "[" << (_soft?"Soft":"") << "InstallOneOf: ";
+    for (PoolItemList::const_iterator iter = _oneOfList.begin();
+        iter != _oneOfList.end();
+        iter++)
+       os << *iter;
+
+    return os;
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft)
+    : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool)
+    , _oneOfList (itemList)
+    , _soft (soft)
+{
+}
+
+
+SolverQueueItemInstallOneOf::~SolverQueueItemInstallOneOf()
+{
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItem_Ptr
+SolverQueueItemInstallOneOf::copy (void) const
+{
+    SolverQueueItemInstallOneOf_Ptr new_installOneOf = new SolverQueueItemInstallOneOf (pool(), _oneOfList, _soft);
+    new_installOneOf->SolverQueueItem::copy(this);
+
+    new_installOneOf->_soft = _soft;
+    return new_installOneOf;
+}
+
+
+//---------------------------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
diff --git a/zypp/sat/SolverQueueItemInstallOneOf.h b/zypp/sat/SolverQueueItemInstallOneOf.h
new file mode 100644 (file)
index 0000000..1d428b2
--- /dev/null
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* QueueItem.h
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H
+#define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/sat/SolverQueueItem.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+DEFINE_PTR_TYPE(SolverQueueItemInstallOneOf);
+       
+
+///////////////////////////////////////////////////////////////////
+//
+//     CLASS NAME : SolverQueueItemInstallOneOf
+
+class SolverQueueItemInstallOneOf : public SolverQueueItem {
+
+  public:
+    typedef std::list<PoolItem> PoolItemList;
+    
+  private:
+
+    PoolItemList _oneOfList; // List of candidates
+    bool _soft;              // if triggered by a soft requirement (a recommends)
+
+  public:
+
+    SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft = false);
+    virtual ~SolverQueueItemInstallOneOf();
+    
+    // ---------------------------------- I/O
+
+    virtual std::ostream & dumpOn( std::ostream & str ) const;
+
+    friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstallOneOf & obj)
+    { return obj.dumpOn (str); }
+
+    // ---------------------------------- accessors
+
+    bool isSoft (void) const { return _soft; }    
+
+    // ---------------------------------- methods
+
+    virtual SolverQueueItem_Ptr copy (void) const;
+    virtual int cmp (SolverQueueItem_constPtr item) const;
+};
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
+#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H
diff --git a/zypp/sat/SolverQueueItemUpdate.cc b/zypp/sat/SolverQueueItemUpdate.cc
new file mode 100644 (file)
index 0000000..750938c
--- /dev/null
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* SolverQueueItem.cc
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "zypp/base/Logger.h"
+#include "zypp/sat/SolverQueueItemUpdate.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp 
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+IMPL_PTR_TYPE(SolverQueueItemUpdate);
+
+//---------------------------------------------------------------------------
+
+std::ostream &
+SolverQueueItemUpdate::dumpOn( std::ostream & os ) const
+{
+    os << "[" << (_soft?"Soft":"") << "Update: ";
+    os << _item;
+
+    return os;
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool,
+                                             const PoolItem & item, bool soft)
+    : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool)
+    , _item (item)
+    , _soft (soft)
+{
+}
+
+
+SolverQueueItemUpdate::~SolverQueueItemUpdate()
+{
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItem_Ptr
+SolverQueueItemUpdate::copy (void) const
+{
+    SolverQueueItemUpdate_Ptr new_update = new SolverQueueItemUpdate (pool(), _item);
+    new_update->SolverQueueItem::copy(this);
+
+    new_update->_soft = _soft;
+    return new_update;
+}
+
+
+//---------------------------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
diff --git a/zypp/sat/SolverQueueItemUpdate.h b/zypp/sat/SolverQueueItemUpdate.h
new file mode 100644 (file)
index 0000000..8f41da2
--- /dev/null
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* QueueItem.h
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H
+#define ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/sat/SolverQueueItem.h"
+#include "zypp/PoolItem.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+  namespace solver
+  { /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+    namespace detail
+    { ///////////////////////////////////////////////////////////////////
+
+DEFINE_PTR_TYPE(SolverQueueItemUpdate);
+       
+
+///////////////////////////////////////////////////////////////////
+//
+//     CLASS NAME : SolverQueueItemUpdate
+
+class SolverQueueItemUpdate : public SolverQueueItem {
+    
+  private:
+
+    PoolItem _item;    // the item to-be-updated
+    bool _soft;         // if triggered by a soft requirement (a recommends)
+
+  public:
+
+    SolverQueueItemUpdate (const ResPool & pool, const PoolItem & item, bool soft = false);
+    virtual ~SolverQueueItemUpdate();
+    
+    // ---------------------------------- I/O
+
+    virtual std::ostream & dumpOn( std::ostream & str ) const;
+
+    friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemUpdate & obj)
+    { return obj.dumpOn (str); }
+
+    // ---------------------------------- accessors
+
+    bool isSoft (void) const { return _soft; }    
+
+    // ---------------------------------- methods
+
+    virtual SolverQueueItem_Ptr copy (void) const;
+    virtual int cmp (SolverQueueItem_constPtr item) const;
+};
+
+///////////////////////////////////////////////////////////////////
+    };// namespace detail
+    /////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
+  };// namespace solver
+  ///////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
+#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H