1/*
2 * Copyright 2011-2015, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _PACKAGE__REQUEST_H_
6#define _PACKAGE__REQUEST_H_
7
8
9#include <SupportDefs.h>
10
11#include <package/Job.h>
12
13
14namespace BSupportKit {
15	namespace BPrivate {
16		class JobQueue;
17	}
18}
19
20
21namespace BPackageKit {
22
23
24class BContext;
25
26
27class BRequest : protected BSupportKit::BJobStateListener {
28public:
29								BRequest(const BContext& context);
30	virtual						~BRequest();
31
32			status_t			InitCheck() const;
33
34	virtual	status_t			CreateInitialJobs() = 0;
35
36			BSupportKit::BJob*	PopRunnableJob();
37
38			status_t			Process(bool failIfCanceledOnly = false);
39
40protected:
41			status_t			QueueJob(BSupportKit::BJob* job);
42
43			const BContext&		fContext;
44
45protected:
46			status_t			fInitStatus;
47			BSupportKit::BPrivate::JobQueue*
48								fJobQueue;
49};
50
51
52}	// namespace BPackageKit
53
54
55#endif // _PACKAGE__REQUEST_H_
56