libzypp: zypp::CombinedProgressData Class Reference

libzypp 17.38.7

zypp::CombinedProgressData Class Reference

Progress callback from another progress. More...

`#include <zypp-core/ui/progressdata.h>`

## Public Member Functions
| CombinedProgressData (ProgressData &pd, ProgressData::value_type weight=0)
| Ctor.
bool | operator() (const ProgressData &progress)
| Implements the ProgressData::ReceiverFnc callback interface.

## Private Attributes
ProgressData::value_type | _weight
ProgressData::value_type | _last_value
ProgressData & | _pd

## Detailed Description

Progress callback from another progress.

This class allows you to pass a progress callback to a subtask based on a current progress data, plus a weight value. Every progress reported by the subtask via this callback will be forwarded to the main progress data, with the corresponding weight.

Example:

// receiver for main task
void task_receiver( ProgressData &progress );
// subtask prototypes
void do_subtask_one( ProgressData::ReceiverFnc &fnc );
void do_subtask_two( ProgressData::ReceiverFnc &fnc );
// main task
ProgressData progress;
//progress for subtask 1
// which is 80%
CombinedProgressData sub1(pd, 80);
// the second is only 20%
CombinedProgressData sub2(pd, 20);
do_subtask_one( sub1 );
do_subtask_two( sub2 );
zypp::CombinedProgressData::CombinedProgressData
CombinedProgressData(ProgressData &pd, ProgressData::value_type weight=0)
Ctor.
Definition progressdata.cc:133
zypp::ProgressData
Maintain [min,max] and counter (value) for progress counting.
Definition progressdata.h:132
zypp::ProgressData::ReceiverFnc
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition progressdata.h:140

Definition at line 393 of file progressdata.h.

## Constructor & Destructor Documentation

## ◆ CombinedProgressData()

zypp::CombinedProgressData::CombinedProgressData | ( | ProgressData & | pd,
|  | ProgressData::value_type | weight = 0 )

Ctor.

Creates a ProgressData::ReceiverFnc from a ProgressData object

Parameters

  pd | ProgressData object
  weight | Weight of the subtask relative to the main task range.

If weight is 0, or

Parameters

  pd | only reports keepalives. then only ticks are sent.

Definition at line 133 of file progressdata.cc.

## Member Function Documentation

## ◆ operator()()

bool zypp::CombinedProgressData::operator() | ( | const ProgressData & | progress | ) |

Implements the ProgressData::ReceiverFnc callback interface.

Definition at line 142 of file progressdata.cc.

## Member Data Documentation

## ◆ _weight

ProgressData::value_type zypp::CombinedProgressData::_weight
| private

Definition at line 420 of file progressdata.h.

## ◆ _last_value

ProgressData::value_type zypp::CombinedProgressData::_last_value
| private

Definition at line 421 of file progressdata.h.

## ◆ _pd

ProgressData& zypp::CombinedProgressData::_pd
| private

Definition at line 422 of file progressdata.h.

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

- zypp-core/ui/progressdata.h
- zypp-core/ui/progressdata.cc