Contains information of the current progress of a task being performed. More...
#include <ms_progress_info.hpp>
Public Types | |
| enum | STATUS { S_NOT_STARTED , S_RUNNING , S_RUNNING_INDETERMINATE , S_PAUSED , S_STOPPED_FAIL , S_STOPPED_BREAK , S_STOPPED_COMPLETE } |
| Enum containing progress status information values. More... | |
Public Member Functions | |
| ms_progress_info () | |
| Default constructor; for standard library collections. | |
| ms_progress_info (const std::string &description, size_t total) | |
| Constructor. | |
| ~ms_progress_info () | |
| Destructor. | |
| void | addSubtask (const ms_progress_info *task) |
| Adds the passed ms_progress_info item as a subtask. | |
| ms_progress_info * | addSubtask (const std::string &description, size_t total) |
| Adds a subtask with the specified description and total number of items. | |
| void | clear (const std::string &description="", size_t total=0) |
| Clear any existing progress information ready to start a new long running operation using the same process names. | |
| const std::string & | getDescription () const |
| Returns the task description. | |
| int | getNumberOfSubtasks () const |
| Returns the total number of child ms_progress_info objects associated directly with the ms_progress_info instance. | |
| size_t | getProgress () const |
| Returns the number of work items currently completed by the process running the task. | |
| STATUS | getStatus () const |
| Gets the current ms_progress_info::STATUS associated with the task. | |
| const ms_progress_info * | getSubtaskProgress (int index) const |
| Returns the child ms_progress_info object at the specified index. | |
| size_t | getTotal () const |
| Returns the total number of work items the task is expected to complete. | |
| bool | isBreaking () const |
| Returns whether or not a break request has been made by the user/client software. | |
| void | removeSubtask (int index) |
| Removes and deletes the child ms_progress_info object at the specified index. | |
| void | resumeAfterPause () |
| Set a paused task to be running again. | |
| void | setBreak () const |
| Sends a break/cancel request to this and all child ms_progress_info tasks. | |
| void | updateBreak () |
| Updates the status to a break state. | |
| void | updateComplete () |
| Updates the status to a completed state. | |
| void | updateFail () |
| Updates the status to a fail state. | |
| void | updateIndeterminate () |
| Updates the status to an indeterminate running state. | |
| void | updatePaused () |
| Updates the status to a paused state. | |
| void | updateProgress (size_t progress, size_t total) |
| Updates the current progress and total number of work items with the passed values. | |
Contains information of the current progress of a task being performed.
If there are sub-jobs that are carried out then these are represented as child objects.
| enum STATUS |
Enum containing progress status information values.
| ms_progress_info | ( | const std::string & | description, |
| size_t | total | ||
| ) |
Constructor.
Creates a new ms_progress_info object with the specified description and total number of items
| description | The task description associated with the generated ms_progress_info object |
| total | The total number of jobs the task will complete |
| ~ms_progress_info | ( | ) |
Destructor.
The desctrutor deletes all subtasks that it has created
If a subtask has been created by calling addSubtask(const std::string & description, size_t) then the object will be deleted here by the parent object.
If an ms_progress_info object was created separately, and then added as a subtask, by calling: addSubtask(const ms_progress_info *), then it won't be deleted in this destructor. It's up to the code that created it to perform the deletion after any object(s) it was added to have been deleted.
| const std::string & getDescription | ( | ) | const |
Returns the task description.
| int getNumberOfSubtasks | ( | ) | const |
Returns the total number of child ms_progress_info objects associated directly with the ms_progress_info instance.
Only the number of direct child items is returned.
| size_t getProgress | ( | ) | const |
Returns the number of work items currently completed by the process running the task.
| ms_progress_info::STATUS getStatus | ( | ) | const |
Gets the current ms_progress_info::STATUS associated with the task.
| const ms_progress_info * getSubtaskProgress | ( | int | index | ) | const |
Returns the child ms_progress_info object at the specified index.
| index | The index of the subtask to return. Must be in the range 1 .. getNumberOfSubtasks() |
| size_t getTotal | ( | ) | const |
Returns the total number of work items the task is expected to complete.
| void setBreak | ( | ) | const |
Sends a break/cancel request to this and all child ms_progress_info tasks.
Use from the client code to request that a long running process is cancelled. It is the responsibility of the process running the task to honour the break request.