[Aptitude-svn-commit] r4086 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver

Daniel Burrows dburrows at costa.debian.org
Wed Sep 14 21:33:35 UTC 2005


Author: dburrows
Date: Wed Sep 14 21:33:28 2005
New Revision: 4086

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/solution.h
Log:
Add support for cloning a whole solution.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Sep 14 21:33:28 2005
@@ -1,5 +1,9 @@
 2005-09-14  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/problemresolver/solution.h:
+
+	  Add support for cloning an entire solution.
+
 	* src/resolver_manager.cc, src/resolver_manager.h:
 
 	  Instead of providing a limited interface to just step around and

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/solution.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/solution.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/solution.h	Wed Sep 14 21:33:28 2005
@@ -285,6 +285,23 @@
       real_soln->incref();
   }
 
+  /** Generate a new, identical solution that shares no memory with
+   *  this solution and hence is safe to hand to another thread.  Note
+   *  that as with other refcounted structures, the handover should be
+   *  done "at one remove" by allocating a generic_solution object on
+   *  the heap.
+   */
+  generic_solution clone() const
+  {
+    return generic_solution(new solution_rep(get_actions().clone(),
+					     get_broken().clone(),
+					     get_unresolved_soft_deps().clone(),
+					     get_forbidden_versions().clone(),
+					     get_score(),
+					     get_action_score()));
+  }
+
+
   /** Generate the root node for a search in the given universe. */
   static generic_solution root_node(const imm::set<dep> &initial_broken,
 				    const PackageUniverse &universe,



More information about the Aptitude-svn-commit mailing list