2011-01-22 01:18:58 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-25 20:07:27 +03:00
|
|
|
#ifndef _PACKAGE__REQUEST_H_
|
|
|
|
#define _PACKAGE__REQUEST_H_
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
#include <package/Job.h>
|
2011-01-24 23:48:03 +03:00
|
|
|
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
namespace BPackageKit {
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
class BContext;
|
|
|
|
namespace BPrivate {
|
|
|
|
class JobQueue;
|
|
|
|
}
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
class BRequest : protected BJobStateListener {
|
2011-01-22 01:18:58 +03:00
|
|
|
public:
|
2011-01-25 20:07:27 +03:00
|
|
|
BRequest(const BContext& context);
|
|
|
|
virtual ~BRequest();
|
|
|
|
|
|
|
|
status_t InitCheck() const;
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-24 23:48:03 +03:00
|
|
|
virtual status_t CreateInitialJobs() = 0;
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
BJob* PopRunnableJob();
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2013-04-20 15:26:34 +04:00
|
|
|
status_t Process(bool failIfCanceledOnly = false);
|
|
|
|
|
2011-01-22 01:18:58 +03:00
|
|
|
protected:
|
2011-01-25 20:07:27 +03:00
|
|
|
status_t QueueJob(BJob* job);
|
2011-01-24 23:48:03 +03:00
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
const BContext& fContext;
|
2011-01-24 23:48:03 +03:00
|
|
|
|
2013-04-20 23:12:40 +04:00
|
|
|
protected:
|
2011-01-25 20:07:27 +03:00
|
|
|
status_t fInitStatus;
|
2013-09-01 16:10:33 +04:00
|
|
|
BPrivate::JobQueue* fJobQueue;
|
2011-01-22 01:18:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
} // namespace BPackageKit
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
#endif // _PACKAGE__REQUEST_H_
|