libgig  4.4.1
RIFF::progress_t Struct Reference

Used for indicating the progress of a certain task. More...

#include <RIFF.h>

Public Member Functions

std::vector< progress_tsubdivide (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_tsubdivide (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!
 

Detailed Description

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.

Definition at line 163 of file RIFF.h.

Member Function Documentation

◆ subdivide() [1/2]

std::vector< progress_t > RIFF::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.

Parameters
iSubtasks- total amount sub tasks this task should be subdivided
Returns
subtasks

Definition at line 93 of file RIFF.cpp.

◆ subdivide() [2/2]

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:

std::vector<progress_t> subprogresses = progress.subdivide({0.1, 0.5, 0.4});
Parameters
vSubTaskPortions- amount and individual weight of subtasks to be created
Returns
subtasks

Definition at line 125 of file RIFF.cpp.

References RIFF::File::FileHandle(), RIFF::File::FileOffsetSize, and RIFF::File::FileWriteHandle().


The documentation for this struct was generated from the following files: