Progress.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 
00011 
00012 #ifndef __PROGRESS_H
00013 #define __PROGRESS_H
00014 
00015 #include "ConfigurationSettings.h"
00016 #include "EnumWrapper.h"
00017 #include "Subject.h"
00018 
00019 #include <string>
00020 
00021 /**
00022  *  Specifies the state of the status message.
00023  *
00024  *  The reporting level indicates the circumstances surrounding the current
00025  *  progress status and displays the appropriate message in the progress dialog.
00026  */
00027 enum ReportingLevelEnum
00028 {
00029    NORMAL = 0,    /**< A brief status message is displayed. */
00030    WARNING,       /**< An extended status message is displayed with scrolling text as necessary. */
00031    ABORT,         /**< The user has aborted the process.\   The progress dialog indicates a zero
00032                        percent complete, and the Cancel button text changes to Close. */
00033    ERRORS         /**< An error has occurred in the process.\   The progress dialog indicates the
00034                        current percent complete, and the Cancel button text changes to Close. */
00035 };
00036 
00037 /**
00038  * @EnumWrapper ::ReportingLevelEnum.
00039  */
00040 typedef EnumWrapper<ReportingLevelEnum> ReportingLevel;
00041 
00042 /**
00043  *  %Progress reporting interface.
00044  *
00045  *  This object serves as a collector of progress/activity notifications.
00046  *  Whenever it receives an update, it notifies any clients that might
00047  *  have registered with the object so they can interrogate what the
00048  *  change was and render/react to it as appropriate.
00049  *
00050  *  This subclass of Subject will notify upon the following conditions:
00051  *  - The following method is called: updateProgress().
00052  *  - Everything else documented in Subject.
00053  *
00054  *  @see        Subject
00055  */
00056 class Progress : public Subject
00057 {
00058 public:
00059    SETTING(AutoClose, Progress, bool, false)
00060 
00061    /**
00062     *  Indicate that some activity has taken place.
00063     *
00064     *  @param   text
00065     *           %Message indicating the nature of the activity being reported.
00066     *  @param   percent
00067     *           For partial completion status changes, this figure represents
00068     *           what percent (0-100) of the activity has cumulatively been
00069     *           completed.
00070     *  @param   gran
00071     *           Reporting level granularity, allowing clients to filter out
00072     *           activity changes they are not interested in. For example,
00073     *           most clients would ignore debugging mode notifications.
00074     *
00075     *  @notify  This method will notify Subject::signalModified.
00076     */
00077    virtual void updateProgress(const std::string& text, int percent, ReportingLevel gran) = 0;
00078 
00079    /**
00080     *  Report the activity that has taken place.
00081     *
00082     *  @param   text
00083     *           %Message indicating the nature of the activity being reported.
00084     *  @param   percent
00085     *           For partial completion status changes, this figure represents
00086     *           what percent (0-100) of the activity has cumulatively been
00087     *           completed.
00088     *  @param   gran
00089     *           Reporting level granularity, allowing clients to filter out
00090     *           activity changes they are not interested in. For example,
00091     *           most clients would ignore debugging mode notifications.
00092     */
00093    virtual void getProgress(std::string& text, int& percent, ReportingLevel& gran) const = 0;
00094 
00095 protected:
00096    /**
00097     * This should be destroyed by calling UtilityServices::destroyProgress.
00098     */
00099    virtual ~Progress() {}
00100 };
00101 
00102 #endif

Software Development Kit - Opticks 4.9.0 Build 16218