aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/decisions.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-13 16:04:52 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 13:22:07 +0100
commitc8eae70be8510bdd42283c1ecac745af2f9a8a80 (patch)
treeacf6352e5f3b4dbad79f3f8ce29c6ec84dbd8591 /paludis/resolver/decisions.cc
parent4385b8c9283bb33f412281dd40da09569476cfc4 (diff)
downloadpaludis-c8eae70be8510bdd42283c1ecac745af2f9a8a80.tar.gz
paludis-c8eae70be8510bdd42283c1ecac745af2f9a8a80.tar.xz
Linearise, but in no particular order
Diffstat (limited to 'paludis/resolver/decisions.cc')
-rw-r--r--paludis/resolver/decisions.cc36
1 files changed, 29 insertions, 7 deletions
diff --git a/paludis/resolver/decisions.cc b/paludis/resolver/decisions.cc
index 624ad12..1203e44 100644
--- a/paludis/resolver/decisions.cc
+++ b/paludis/resolver/decisions.cc
@@ -18,7 +18,12 @@
*/
#include <paludis/resolver/decisions.hh>
+#include <paludis/resolver/decision.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
+#include <list>
using namespace paludis;
using namespace paludis::resolver;
@@ -28,23 +33,40 @@ namespace paludis
#ifdef PALUDIS_NO_DOUBLE_TEMPLATE
template <>
#endif
- template <typename D_>
- struct Implementation<Decisions<D_> >
+ template <typename Decision_>
+ struct Implementation<Decisions<Decision_> >
{
+ std::list<std::tr1::shared_ptr<const Decision_> > values;
};
}
-template <typename D_>
-Decisions<D_>::Decisions() :
- PrivateImplementationPattern<Decisions<D_> >(new Implementation<Decisions<D_> >)
+template <typename Decision_>
+Decisions<Decision_>::Decisions() :
+ PrivateImplementationPattern<Decisions<Decision_> >(new Implementation<Decisions<Decision_> >)
{
}
-template <typename D_>
-Decisions<D_>::~Decisions()
+template <typename Decision_>
+Decisions<Decision_>::~Decisions()
{
}
+template <typename Decision_>
+void
+Decisions<Decision_>::push_back(const std::tr1::shared_ptr<const Decision_> & d)
+{
+ _imp->values.push_back(d);
+}
+
+template <typename Decision_>
+void
+Decisions<Decision_>::cast_push_back(const std::tr1::shared_ptr<const Decision> & d)
+{
+ if (! simple_visitor_cast<const Decision_>(*d))
+ throw InternalError(PALUDIS_HERE, "Wrong Decision type");
+ push_back(std::tr1::static_pointer_cast<const Decision_>(d));
+}
+
template class Decisions<UnableToMakeDecision>;
template class Decisions<ChangesToMakeDecision>;
template class Decisions<ChangeOrRemoveDecision>;