Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_progress_info.hpp
1/*
2##############################################################################
3# file: ms_progress_info.hpp
4# 'msparser' toolkit
5# Current progress through a file load or dave
6##############################################################################
7# COPYRIGHT NOTICE
8# Copyright 1998-2014 Matrix Science Limited All Rights Reserved.
9#
10##############################################################################
11 * @(#)$Source: parser/inc/ms_progress_info.hpp $
12 * @(#)$Revision: dca23d57fba4e39e0d84eb2d20eef5bcbc9e3f0c | MSPARSER_REL_3_1_0-2025-07-27-0-gea47708fac $
13 * @(#)$Date: 2024-11-19 16:32:02 +0000 $
14##############################################################################
15 */
16
17#ifndef MS_PROGRESS_INFO_HPP
18#define MS_PROGRESS_INFO_HPP
19
20
21// Includes from the standard template library
22#include <list>
23#include <string>
24
25namespace matrix_science
26{
27 //=========================================================================
33 class ms_progress_info;
34
36
39 class MS_MASCOTRESFILE_API ms_progress_info
40 {
41 public:
43 enum STATUS
44 {
51 S_STOPPED_COMPLETE
52 };
53
56
58 ms_progress_info(const std::string & description, size_t total);
59
62
64 void clear(const std::string & description = "", size_t total = 0);
66 STATUS getStatus() const;
68 const std::string & getDescription() const;
70 size_t getTotal() const;
72 size_t getProgress() const;
74 int getNumberOfSubtasks() const;
76 const ms_progress_info * getSubtaskProgress(int index) const;
78 void setBreak() const;
79
81 ms_progress_info * addSubtask(const std::string & description, size_t total);
83 void addSubtask(const ms_progress_info * task);
85 void updateProgress(size_t progress, size_t total);
87 void updateFail();
89 void updateBreak();
91 void updatePaused();
93 void resumeAfterPause();
95 void updateComplete();
97 void updateIndeterminate();
99 bool isBreaking() const;
101 void removeSubtask(int index);
102
103 private:
104 // noncopyable
106 void operator= (const ms_progress_info &);
107
108 std::string description_;
109 STATUS status_;
110 size_t total_;
111 size_t progress_;
112 mutable bool break_;
113
114 // The bool item in the list is used to specify whether the parent
115 // destructor should delete the child object.
116 // If the object is created by calling
117 // addSubtask(description, total) then it has been created by the
118 // parent and will be deleted by the parent.
119 std::list<std::pair<bool, ms_progress_info*> > subtasks_;
120 };
121 // end of quantitation_group
123 //=========================================================================
124
125} // namespace matrix_science
126
127#endif // MS_PROGRESS_INFO_HPP
128
129/*------------------------------- End of File -------------------------------*/
Contains information of the current progress of a task being performed.
Definition: ms_progress_info.hpp:40
STATUS
Enum containing progress status information values.
Definition: ms_progress_info.hpp:44
@ S_STOPPED_BREAK
Task was cancelled by the user.
Definition: ms_progress_info.hpp:50
@ S_STOPPED_FAIL
Task failed.
Definition: ms_progress_info.hpp:49
@ S_PAUSED
Task is paused while another task is running. When that task is complete, this one can be set running...
Definition: ms_progress_info.hpp:48
@ S_RUNNING
Task is currently running.
Definition: ms_progress_info.hpp:46
@ S_NOT_STARTED
Task has not started.
Definition: ms_progress_info.hpp:45
@ S_RUNNING_INDETERMINATE
Task is running but progress is indeterminate.
Definition: ms_progress_info.hpp:47