00001 /*MT* 00002 */ 00003 00004 #include "common.h" 00005 00006 #ifndef __GENERIC_TASK_H__ 00007 #define __GENERIC_TASK_H__ 00008 00009 enum task_type_t 00010 { 00011 Invalid, 00012 AddFile, 00013 RemoveObject, 00014 LoadAccounting, 00015 RescanDirectory, 00016 FetchOnlineContent 00017 }; 00018 00019 enum task_owner_t 00020 { 00021 ContentManagerTask, 00022 TaskProcessorTask 00023 }; 00024 00025 class GenericTask : public zmm::Object 00026 { 00027 protected: 00028 zmm::String description; 00029 task_type_t taskType; 00030 task_owner_t taskOwner; 00031 unsigned int parentTaskID; 00032 unsigned int taskID; 00033 bool valid; 00034 bool cancellable; 00035 00036 public: 00037 GenericTask(task_owner_t taskOwner); 00038 virtual void run() = 0; 00039 inline void setDescription(zmm::String description) { this->description = description; }; 00040 inline zmm::String getDescription() { return description; }; 00041 inline task_type_t getType() { return taskType; }; 00042 inline unsigned int getID() { return taskID; }; 00043 inline unsigned int getParentID() { return parentTaskID; }; 00044 inline void setID(unsigned int taskID) { this->taskID = taskID; }; 00045 inline void setParentID(unsigned int parentTaskID = 0) { this->parentTaskID = parentTaskID; }; 00046 inline bool isValid() { return valid; }; 00047 inline bool isCancellable() { return cancellable; }; 00048 inline void invalidate() { valid = false; }; 00049 inline task_owner_t getOwner() { return taskOwner; }; 00050 }; 00051 00052 #endif//__GENERIC_TASK_H__ 00053
1.6.1