Matrix Science header

ms_progress_info.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_progress_info.hpp
00004 # 'msparser' toolkit
00005 # Current progress through a file load or dave
00006 ##############################################################################
00007 # COPYRIGHT NOTICE
00008 # Copyright 1998-2014 Matrix Science Limited  All Rights Reserved.
00009 #
00010 ##############################################################################
00011  * @(#)$Source: parser/inc/ms_progress_info.hpp $
00012  * @(#)$Revision: 13eeeb76d98cb3364b3262ac81b740f5a2a28aba | MSPARSER_REL_2_8_1-0-gea32989045 $
00013  * @(#)$Date: 2018-10-18 17:21:45 +0100 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_PROGRESS_INFO_HPP
00018 #define MS_PROGRESS_INFO_HPP
00019 
00020 
00021 // Includes from the standard template library
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             // noncopyable
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             // The bool item in the list is used to specify whether the parent 
00110             // destructor should delete the child object. 
00111             // If the object is created by calling 
00112             // addSubtask(description, total) then it has been created by the
00113             // parent and will be deleted by the parent. 
00114             std::list<std::pair<bool, ms_progress_info*> > subtasks_;
00115     };
00116  // end of quantitation_group
00118     //=========================================================================
00119 
00120 } // namespace matrix_science
00121 
00122 #endif // MS_PROGRESS_INFO_HPP
00123 
00124 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29