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: /vol/cvsroot/parser/inc/ms_progress_info.hpp,v $
00012  * @(#)$Revision: 1.1 $
00013  * @(#)$Date: 2015/01/08 15:34:26 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_PROGRESS_INFO_HPP
00018 #define MS_PROGRESS_INFO_HPP
00019 
00020 #ifdef _WIN32
00021 #pragma warning(disable:4251)   // Don't want all classes to be exported
00022 #pragma warning(disable:4786)   // Debug symbols too long
00023 #   ifndef _MATRIX_USE_STATIC_LIB
00024 #       ifdef MS_MASCOTRESFILE_EXPORTS
00025 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00026 #       else
00027 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00028 #       endif
00029 #   else
00030 #       define MS_MASCOTRESFILE_API
00031 #   endif
00032 #else
00033 #   define MS_MASCOTRESFILE_API
00034 #endif
00035 
00036 // Includes from the standard template library
00037 #include <list>
00038 #include <string>
00039 
00040 namespace matrix_science
00041 {
00042     //=========================================================================
00048     class ms_progress_info;
00049 
00051 
00054     class MS_MASCOTRESFILE_API ms_progress_info
00055     {
00056         public:
00057 
00058             enum STATUS
00059             {
00060                 S_NOT_STARTED,
00061                 S_RUNNING,
00062                 S_STOPPED_FAIL,
00063                 S_STOPPED_BREAK,
00064                 S_STOPPED_COMPLETE
00065             };
00066 
00068             ms_progress_info();
00069 
00070             ms_progress_info(const std::string & description, int total);
00071 
00072             ~ms_progress_info();
00073 
00075             void clear(const std::string & description = "", int total = 0);
00076 
00077             STATUS getStatus();
00078             const std::string & getDescription() const;
00079             int getTotal() const;
00080             int getProgress() const;
00081 
00082             int getNumberOfSubtasks() const;
00083             const ms_progress_info * getSubtaskProgress(int index) const;
00084 
00085             void setBreak() const;
00086 
00087             // internal use only
00088             ms_progress_info * addSubtask(const std::string & description, int total);
00089             void addSubtask(const ms_progress_info * task);
00090             void updateProgress(int progress, int total);
00091             void updateFail();
00092             void updateBreak();
00093             void updateComplete();
00094             bool isBreaking();
00095 
00096         private:
00097             // noncopyable
00098             ms_progress_info(const ms_progress_info &);
00099             void operator= (const ms_progress_info &);
00100 
00101             std::string description_;
00102             STATUS status_;
00103             int total_;
00104             int progress_;
00105             mutable bool break_;
00106             std::list<std::pair<bool, ms_progress_info*> > subtasks_;
00107     };
00108  // end of quantitation_group
00110     //=========================================================================
00111 
00112 } // namespace matrix_science
00113 
00114 #endif // MS_PROGRESS_INFO_HPP
00115 
00116 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51