aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/job.hh
blob: 02eba91f95e12605dc8e2d75258d2b9b2ce9d412 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * Copyright (c) 2010, 2011 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
 */

#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_JOB_HH
#define PALUDIS_GUARD_PALUDIS_RESOLVER_JOB_HH 1

#include <paludis/resolver/job-fwd.hh>
#include <paludis/resolver/job_state-fwd.hh>
#include <paludis/resolver/job_requirements-fwd.hh>
#include <paludis/resolver/destination_types-fwd.hh>
#include <paludis/util/pimp.hh>
#include <paludis/util/visitor.hh>
#include <paludis/util/type_list.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/serialise-fwd.hh>
#include <paludis/name-fwd.hh>
#include <memory>

namespace paludis
{
    namespace resolver
    {
        class PALUDIS_VISIBLE PretendJob
        {
            private:
                Pimp<PretendJob> _imp;

            public:
                PretendJob(
                        const PackageDepSpec &,
                        const RepositoryName &,
                        const DestinationType
                        );
                ~PretendJob();

                const PackageDepSpec origin_id_spec() const PALUDIS_ATTRIBUTE((warn_unused_result));
                const RepositoryName destination_repository_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
                DestinationType destination_type() const PALUDIS_ATTRIBUTE((warn_unused_result));

                static const std::shared_ptr<PretendJob> deserialise(Deserialisation &) PALUDIS_ATTRIBUTE((warn_unused_result));
                void serialise(Serialiser &) const;
        };

        class PALUDIS_VISIBLE ExecuteJob :
            public virtual DeclareAbstractAcceptMethods<ExecuteJob, MakeTypeList<
                FetchJob, InstallJob, UninstallJob>::Type>
        {
            public:
                virtual ~ExecuteJob();

                virtual const std::shared_ptr<JobState> state() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
                virtual void set_state(const std::shared_ptr<JobState> &) = 0;

                virtual const std::shared_ptr<const JobRequirements> requirements() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;

                static const std::shared_ptr<ExecuteJob> deserialise(Deserialisation &) PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void serialise(Serialiser &) const = 0;
        };

        class PALUDIS_VISIBLE FetchJob :
            public ExecuteJob,
            public ImplementAcceptMethods<ExecuteJob, FetchJob>
        {
            private:
                Pimp<FetchJob> _imp;

            public:
                FetchJob(
                        const std::shared_ptr<const JobRequirements> &,
                        const PackageDepSpec &
                        );
                ~FetchJob();

                const PackageDepSpec origin_id_spec() const PALUDIS_ATTRIBUTE((warn_unused_result));

                virtual const std::shared_ptr<JobState> state() const PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void set_state(const std::shared_ptr<JobState> &);

                virtual const std::shared_ptr<const JobRequirements> requirements() const PALUDIS_ATTRIBUTE((warn_unused_result));

                static const std::shared_ptr<FetchJob> deserialise(Deserialisation &) PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void serialise(Serialiser &) const;
        };

        class PALUDIS_VISIBLE InstallJob :
            public ExecuteJob,
            public ImplementAcceptMethods<ExecuteJob, InstallJob>
        {
            private:
                Pimp<InstallJob> _imp;

            public:
                InstallJob(
                        const std::shared_ptr<const JobRequirements> &,
                        const PackageDepSpec &,
                        const RepositoryName &,
                        const DestinationType,
                        const std::shared_ptr<const Sequence<PackageDepSpec> > &);
                ~InstallJob();

                const PackageDepSpec origin_id_spec() const PALUDIS_ATTRIBUTE((warn_unused_result));
                const RepositoryName destination_repository_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
                DestinationType destination_type() const PALUDIS_ATTRIBUTE((warn_unused_result));
                const std::shared_ptr<const Sequence<PackageDepSpec> > replacing_specs() const PALUDIS_ATTRIBUTE((warn_unused_result));

                virtual const std::shared_ptr<JobState> state() const PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void set_state(const std::shared_ptr<JobState> &);

                virtual const std::shared_ptr<const JobRequirements> requirements() const PALUDIS_ATTRIBUTE((warn_unused_result));

                static const std::shared_ptr<InstallJob> deserialise(Deserialisation &) PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void serialise(Serialiser &) const;
        };

        class PALUDIS_VISIBLE UninstallJob :
            public ExecuteJob,
            public ImplementAcceptMethods<ExecuteJob, UninstallJob>
        {
            private:
                Pimp<UninstallJob> _imp;

            public:
                UninstallJob(
                        const std::shared_ptr<const JobRequirements> &,
                        const std::shared_ptr<const Sequence<PackageDepSpec> > &
                        );
                ~UninstallJob();

                const std::shared_ptr<const Sequence<PackageDepSpec> > ids_to_remove_specs() const PALUDIS_ATTRIBUTE((warn_unused_result));

                virtual const std::shared_ptr<JobState> state() const PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void set_state(const std::shared_ptr<JobState> &);

                virtual const std::shared_ptr<const JobRequirements> requirements() const PALUDIS_ATTRIBUTE((warn_unused_result));

                static const std::shared_ptr<UninstallJob> deserialise(Deserialisation &) PALUDIS_ATTRIBUTE((warn_unused_result));
                virtual void serialise(Serialiser &) const;
        };
    }
}

#endif