aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/resolved.cc
blob: 80e515287b695299558b60b5e06f1690a8e658a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * Copyright (c) 2010 Ciaran McCreesh
 *
 * This file is part of the Paludis package manager. Paludis 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.
 *
 * Paludis 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 <paludis/resolver/resolved.hh>
#include <paludis/resolver/decisions.hh>
#include <paludis/resolver/decision.hh>
#include <paludis/resolver/resolutions_by_resolvent.hh>
#include <paludis/resolver/job_lists.hh>
#include <paludis/resolver/nag.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/serialise-impl.hh>

using namespace paludis;
using namespace paludis::resolver;

void
Resolved::serialise(Serialiser & s) const
{
    s.object("Resolved")
        .member(SerialiserFlags<serialise::might_be_null>(), "job_lists", job_lists())
        .member(SerialiserFlags<serialise::might_be_null>(), "nag", nag())
        .member(SerialiserFlags<serialise::might_be_null>(), "resolutions_by_resolvent", resolutions_by_resolvent())
        .member(SerialiserFlags<serialise::might_be_null>(), "taken_change_or_remove_decisions", taken_change_or_remove_decisions())
        .member(SerialiserFlags<serialise::might_be_null>(), "taken_unable_to_make_decisions", taken_unable_to_make_decisions())
        .member(SerialiserFlags<serialise::might_be_null>(), "taken_unconfirmed_decisions", taken_unconfirmed_decisions())
        .member(SerialiserFlags<serialise::might_be_null>(), "taken_unorderable_decisions", taken_unorderable_decisions())
        .member(SerialiserFlags<serialise::might_be_null>(), "untaken_change_or_remove_decisions", untaken_change_or_remove_decisions())
        .member(SerialiserFlags<serialise::might_be_null>(), "untaken_unable_to_make_decisions", untaken_unable_to_make_decisions())
        ;
}

const Resolved
Resolved::deserialise(Deserialisation & d)
{
    Deserialisator v(d, "Resolved");

    return make_named_values<Resolved>(
            n::job_lists() =
                v.member<std::tr1::shared_ptr<JobLists> >("job_lists"),
            n::nag() =
                v.member<std::tr1::shared_ptr<NAG> >("nag"),
            n::resolutions_by_resolvent() =
                v.member<std::tr1::shared_ptr<ResolutionsByResolvent> >("resolutions_by_resolvent"),
            n::taken_change_or_remove_decisions() =
                v.member<std::tr1::shared_ptr<OrderedChangeOrRemoveDecisions> >("taken_change_or_remove_decisions"),
            n::taken_unable_to_make_decisions() =
                v.member<std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > >("taken_unable_to_make_decisions"),
            n::taken_unconfirmed_decisions() =
                v.member<std::tr1::shared_ptr<Decisions<ConfirmableDecision> > >("taken_unconfirmed_decisions"),
            n::taken_unorderable_decisions() =
                v.member<std::tr1::shared_ptr<OrderedChangeOrRemoveDecisions> >("taken_unorderable_decisions"),
            n::untaken_change_or_remove_decisions() =
                v.member<std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > >("untaken_change_or_remove_decisions"),
            n::untaken_unable_to_make_decisions() =
                v.member<std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > >("untaken_unable_to_make_decisions")
            );
}