xref: /haiku/headers/os/package/Request.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
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 
14 namespace BSupportKit {
15 	namespace BPrivate {
16 		class JobQueue;
17 	}
18 }
19 
20 
21 namespace BPackageKit {
22 
23 
24 class BContext;
25 
26 
27 class BRequest : protected BSupportKit::BJobStateListener {
28 public:
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 
40 protected:
41 			status_t			QueueJob(BSupportKit::BJob* job);
42 
43 			const BContext&		fContext;
44 
45 protected:
46 			status_t			fInitStatus;
47 			BSupportKit::BPrivate::JobQueue*
48 								fJobQueue;
49 };
50 
51 
52 }	// namespace BPackageKit
53 
54 
55 #endif // _PACKAGE__REQUEST_H_
56