summaryrefslogtreecommitdiff
path: root/src/generic/problemresolver
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2010-03-04 09:11:02 -0800
committerDaniel Burrows <dburrows@debian.org>2010-03-04 09:11:02 -0800
commit6b2eeff1235a32b97736a564dbc2b02bfcda3587 (patch)
treec6de2ca63586dfe7c73ac16079d78433be9d65eb /src/generic/problemresolver
parent8b2aa68903dfccd5b42ebb4d6769f54ec96c6df5 (diff)
downloadaptitude-6b2eeff1235a32b97736a564dbc2b02bfcda3587.tar.gz
Let client code query the components of a tier operation.
Diffstat (limited to 'src/generic/problemresolver')
-rw-r--r--src/generic/problemresolver/tier_operation.cc13
-rw-r--r--src/generic/problemresolver/tier_operation.h34
2 files changed, 47 insertions, 0 deletions
diff --git a/src/generic/problemresolver/tier_operation.cc b/src/generic/problemresolver/tier_operation.cc
index 1b6e83ba..31de3808 100644
--- a/src/generic/problemresolver/tier_operation.cc
+++ b/src/generic/problemresolver/tier_operation.cc
@@ -215,6 +215,19 @@ tier_operation::op_impl::op_impl(const op_impl &op1, const op_impl &op2, lower_b
}
}
+level tier_operation::op_impl::get_user_level(level_index idx) const
+{
+
+ // "Slow" implementation right now because this isn't used much
+ // (only for display).
+ for(std::vector<std::pair<level_index, level> >::const_iterator it =
+ actions.begin(); it != actions.end(); ++it)
+ if(it->first == idx)
+ return it->second;
+
+ return level();
+}
+
tier_operation tier_operation::least_upper_bound(const tier_operation &op1,
const tier_operation &op2)
{
diff --git a/src/generic/problemresolver/tier_operation.h b/src/generic/problemresolver/tier_operation.h
index 62e74ecb..c6231dc1 100644
--- a/src/generic/problemresolver/tier_operation.h
+++ b/src/generic/problemresolver/tier_operation.h
@@ -124,6 +124,18 @@ class tier_operation
return rval;
}
+ int get_structural_level() const
+ {
+ return structural_level;
+ }
+
+ level get_user_level(std::size_t idx) const;
+
+ bool get_has_user_level_changes() const
+ {
+ return !actions.empty();
+ }
+
/** \brief Test two tier operations for equality.
*
* \note Relies on the fact that the level's equality comparison
@@ -320,6 +332,28 @@ public:
get_impl().dump(out);
}
+ /** \brief Get the structural level that this operation raises its
+ * target to.
+ */
+ int get_structural_level() const
+ {
+ return get_impl().get_structural_level();
+ }
+
+ /** \brief Get the operation performed on a user level. */
+ level get_user_level(int idx) const
+ {
+ return get_impl().get_user_level(idx);
+ }
+
+ /** \brief Check whether any actions performed by the operation
+ * affect user levels.
+ */
+ bool get_has_user_level_changes() const
+ {
+ return get_impl().get_has_user_level_changes();
+ }
+
std::size_t get_hash_value() const
{
return get_impl().get_hash_value();