Some changes to the interface. Implemented most of the methods. The notification stuff is still missing.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4124 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,43 +10,68 @@ struct user_disk_device_job_info;
|
||||
namespace BPrivate {
|
||||
namespace DiskDevice {
|
||||
|
||||
class KDiskDeviceJobQueue;
|
||||
|
||||
class KDiskDeviceJob {
|
||||
public:
|
||||
KDiskDeviceJob(partition_id partition, partition_id scope = -1);
|
||||
KDiskDeviceJob(uint32 type, partition_id partitionID,
|
||||
partition_id scopeID = -1);
|
||||
virtual ~KDiskDeviceJob();
|
||||
|
||||
disk_job_id ID() const;
|
||||
|
||||
void SetJobQueue(KDiskDeviceJobQueue *queue);
|
||||
KDiskDeviceJobQueue *JobQueue() const;
|
||||
|
||||
uint32 Type() const;
|
||||
|
||||
void SetStatus(uint32 status);
|
||||
uint32 Status() const;
|
||||
|
||||
void SetDescription(const char *description);
|
||||
status_t SetDescription(const char *description);
|
||||
const char *Description() const;
|
||||
// Maybe better just a virtual void GetDescription(char*)?
|
||||
|
||||
void SetPartitionID(partition_id partitionID);
|
||||
// Probably not needed, since passed to the constructor.
|
||||
partition_id PartitionID() const;
|
||||
partition_id ScopeID() const;
|
||||
|
||||
virtual void UpdateProgress(float progress);
|
||||
void SetTaskCount(int32 count);
|
||||
int32 TaskCount() const;
|
||||
|
||||
void SetCompletedTasks(int32 count);
|
||||
int32 CompletedTasks() const;
|
||||
|
||||
void SetInterruptProperties(uint32 properties);
|
||||
uint32 InterruptProperties() const;
|
||||
|
||||
virtual void GetTaskDescription(char *description);
|
||||
|
||||
void UpdateProgress(float progress);
|
||||
// may trigger a notification
|
||||
// virtual, since some jobs are composed of several tasks (e.g. Move).
|
||||
// We might want to explicitly support subtasks in the base class, or
|
||||
// even in the userland API.
|
||||
void UpdateExtraProgress(const char *info);
|
||||
// triggers a notification
|
||||
float Progress() const;
|
||||
|
||||
status_t GetInfo(user_disk_device_job_info *info);
|
||||
status_t GetProgressInfo(disk_device_job_progress_info *info);
|
||||
|
||||
virtual status_t Do();
|
||||
virtual status_t Do() = 0;
|
||||
|
||||
// TODO: Do we want to add a Cancel() here? We probably can't tell the
|
||||
// disk system directly anyway. That is, if the job is in progress,
|
||||
// the disk system would have to check the job status periodically
|
||||
// to find out, if the job had been canceled. But then a
|
||||
// SetStatus(B_DISK_DEVICE_JOB_CANCELED) would be sufficient.
|
||||
private:
|
||||
static disk_job_id _NextID();
|
||||
|
||||
disk_job_id fID;
|
||||
KDiskDeviceJobQueue *fJobQueue;
|
||||
uint32 fType;
|
||||
uint32 fStatus;
|
||||
partition_id fPartitionID;
|
||||
partition_id fScopeID;
|
||||
char *fDescription;
|
||||
int32 fTaskCount;
|
||||
int32 fCompletedTasks;
|
||||
uint32 fInterruptProperties;
|
||||
float fProgress;
|
||||
|
||||
static disk_job_id fNextID;
|
||||
};
|
||||
|
||||
} // namespace DiskDevice
|
||||
|
||||
Reference in New Issue
Block a user