libgig
4.3.0
|
Used for indicating the progress of a certain task. More...
#include <RIFF.h>
Public Member Functions | |
std::vector< progress_t > | subdivide (int iSubtasks) |
Divides this progress task into the requested amount of equal weighted sub-progress tasks and returns a vector with those subprogress tasks. More... | |
std::vector< progress_t > | subdivide (std::vector< float > vSubTaskPortions) |
Divides this progress task into the requested amount of sub-progress tasks, where each one of those new sub-progress tasks is created with its requested individual weight / portion, and finally returns a vector with those new subprogress tasks. More... | |
Public Attributes | |
void(* | callback )(progress_t *) |
Callback function pointer which has to be assigned to a function for progress notification. | |
float | factor |
Reflects current progress as value between 0.0 and 1.0. | |
void * | custom |
This pointer can be used for arbitrary data. | |
float | __range_min |
Only for internal usage, do not modify! | |
float | __range_max |
Only for internal usage, do not modify! | |
Used for indicating the progress of a certain task.
The function pointer argument has to be supplied with a valid function of the given signature which will then be called on progress changes. An equivalent progress_t structure will be passed back as argument to the callback function on each progress change. The factor field of the supplied progress_t structure will then reflect the current progress as value between 0.0 and 1.0. You might want to use the custom field for data needed in your callback function.
std::vector< progress_t > RIFF::progress_t::subdivide | ( | int | iSubtasks | ) |
std::vector< progress_t > RIFF::progress_t::subdivide | ( | std::vector< float > | vSubTaskPortions | ) |
Divides this progress task into the requested amount of sub-progress tasks, where each one of those new sub-progress tasks is created with its requested individual weight / portion, and finally returns a vector with those new subprogress tasks.
The amount of subprogresses to be created is determined by this method by calling vSubTaskPortions.size()
.
Example: consider you wanted to create 3 subprogresses where the 1st subtask should be assigned 10% of the new 3 subprogresses' overall progress, the 2nd subtask should be assigned 50% of the new 3 subprogresses' overall progress, and the 3rd subtask should be assigned 40%, then you might call this method like this:
vSubTaskPortions | - amount and individual weight of subtasks to be created |