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: 13eeeb76d98cb3364b3262ac81b740f5a2a28aba | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $
13 * @(#)$Date: 2018-10-18 17:21:45 +0100 $
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 {
50 S_STOPPED_COMPLETE
51 };
52
55
57 ms_progress_info(const std::string & description, size_t total);
58
61
63 void clear(const std::string & description = "", size_t total = 0);
65 STATUS getStatus() const;
67 const std::string & getDescription() const;
69 size_t getTotal() const;
71 size_t getProgress() const;
73 int getNumberOfSubtasks() const;
75 const ms_progress_info * getSubtaskProgress(int index) const;
77 void setBreak() const;
78
80 ms_progress_info * addSubtask(const std::string & description, size_t total);
82 void addSubtask(const ms_progress_info * task);
84 void updateProgress(size_t progress, size_t total);
86 void updateFail();
88 void updateBreak();
90 void updateComplete();
92 void updateIndeterminate();
94 bool isBreaking() const;
96 void removeSubtask(int index);
97
98 private:
99 // noncopyable
101 void operator= (const ms_progress_info &);
102
103 std::string description_;
104 STATUS status_;
105 size_t total_;
106 size_t progress_;
107 mutable bool break_;
108
109 // The bool item in the list is used to specify whether the parent
110 // destructor should delete the child object.
111 // If the object is created by calling
112 // addSubtask(description, total) then it has been created by the
113 // parent and will be deleted by the parent.
114 std::list<std::pair<bool, ms_progress_info*> > subtasks_;
115 };
116 // end of quantitation_group
118 //=========================================================================
119
120} // namespace matrix_science
121
122#endif // MS_PROGRESS_INFO_HPP
123
124/*------------------------------- 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:49
@ S_STOPPED_FAIL
Task failed.
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