00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef MS_PROGRESS_INFO_HPP
00018 #define MS_PROGRESS_INFO_HPP
00019
00020
00021
00022 #include <list>
00023 #include <string>
00024
00025 namespace matrix_science
00026 {
00027
00033 class ms_progress_info;
00034
00036
00039 class MS_MASCOTRESFILE_API ms_progress_info
00040 {
00041 public:
00043 enum STATUS
00044 {
00045 S_NOT_STARTED,
00046 S_RUNNING,
00047 S_RUNNING_INDETERMINATE,
00048 S_STOPPED_FAIL,
00049 S_STOPPED_BREAK,
00050 S_STOPPED_COMPLETE
00051 };
00052
00054 ms_progress_info();
00055
00057 ms_progress_info(const std::string & description, size_t total);
00058
00060 ~ms_progress_info();
00061
00063 void clear(const std::string & description = "", size_t total = 0);
00065 STATUS getStatus() const;
00067 const std::string & getDescription() const;
00069 size_t getTotal() const;
00071 size_t getProgress() const;
00073 int getNumberOfSubtasks() const;
00075 const ms_progress_info * getSubtaskProgress(int index) const;
00077 void setBreak() const;
00078
00080 ms_progress_info * addSubtask(const std::string & description, size_t total);
00082 void addSubtask(const ms_progress_info * task);
00084 void updateProgress(size_t progress, size_t total);
00086 void updateFail();
00088 void updateBreak();
00090 void updateComplete();
00092 void updateIndeterminate();
00094 bool isBreaking() const;
00096 void removeSubtask(int index);
00097
00098 private:
00099
00100 ms_progress_info(const ms_progress_info &);
00101 void operator= (const ms_progress_info &);
00102
00103 std::string description_;
00104 STATUS status_;
00105 size_t total_;
00106 size_t progress_;
00107 mutable bool break_;
00108
00109
00110
00111
00112
00113
00114 std::list<std::pair<bool, ms_progress_info*> > subtasks_;
00115 };
00116
00118
00119
00120 }
00121
00122 #endif // MS_PROGRESS_INFO_HPP
00123
00124