libzypp
13.10.6
|
Maintain [min,max]
and counter (value)
for progress counting.
More...
#include <ProgressData.h>
Classes | |
class | Data |
Public Types | |
typedef long long | value_type |
typedef function< bool(const ProgressData &)> | ReceiverFnc |
Most simple version of progress reporting The percentage in most cases. More... | |
Public Member Functions | |
ProgressData () | |
Ctor no range [0,0](0) . More... | |
ProgressData (value_type max_r) | |
Ctor [0,max](0) . More... | |
ProgressData (value_type min_r, value_type max_r) | |
Ctor [min,max](min) . More... | |
ProgressData (value_type min_r, value_type max_r, value_type val_r) | |
Ctor [min,max](val) . More... | |
~ProgressData () | |
void | min (value_type min_r) |
Set new min value. More... | |
void | max (value_type max_r) |
Set new max value. More... | |
void | noRange () |
Set no range [0,0] . More... | |
void | range (value_type max_r) |
Set new [0,max] . More... | |
void | range (value_type min_r, value_type max_r) |
Set new [min,max] . More... | |
void | name (const std::string &name_r) |
Set counter name. More... | |
void | sendTo (const ReceiverFnc &fnc_r) |
Set ReceiverFnc. More... | |
void | noSend () |
Set no ReceiverFnc. More... | |
Progress reporting. | |
These methods may actually cause a progress report to be sent. All methods return | |
bool | set (value_type val_r) |
Set new counter value . More... | |
bool | incr (value_type val_r=1) |
Increment counter value (default by 1). More... | |
bool | decr (value_type val_r=1) |
Decrement counter value (default by 1). More... | |
bool | toMin () |
Set counter value to current min value. More... | |
bool | toMax () |
Set counter value to current max value (unless no range). More... | |
bool | tick () |
Leave counter value unchanged (still alive). More... | |
Progress receiving. | |
value_type | min () const |
value_type | max () const |
value_type | val () const |
bool | hasRange () const |
bool | reportPercent () const |
bool | reportAlive () const |
value_type | reportValue () const |
const std::string & | name () const |
const ReceiverFnc & | receiver () const |
bool | finalReport () const |
Public Member Functions inherited from zypp::base::ProvideNumericId< ProgressData, unsigned > | |
unsigned | numericId () const |
Private Types | |
enum | State { INIT, RUN, END } |
Private Member Functions | |
bool | report () |
Send report if necessary. More... | |
Private Attributes | |
RWCOW_pointer< Data > | _d |
Pointer to data. More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &str, const ProgressData &obj) |
ProgressData | makeProgressData (const InputStream &input_r) |
Additional Inherited Members | |
Protected Member Functions inherited from zypp::base::ProvideNumericId< ProgressData, unsigned > | |
ProvideNumericId () | |
Default ctor. More... | |
ProvideNumericId (const ProvideNumericId &) | |
Copy ctor. More... | |
ProvideNumericId (const void *const ) | |
No-Id ctor (0). More... | |
ProvideNumericId & | operator= (const ProvideNumericId &) |
Assign. More... | |
~ProvideNumericId () | |
Dtor. More... | |
Maintain [min,max]
and counter (value)
for progress counting.
This class should provide everything the producer of progress data needs. As a convention, a zero sizes range indicates that you are just able to send 'still alive' triggers.
The counter should be updated in reasonable intervals. Don't mind whether the counter value actually increased or not. ProgressData will recognize your triggers and knows when to actually send notification to a consumer.
Each ProgressData object provides a unique numeric id and you may assign it a name.
The different ammount of triggers is due to different rules for sending percent or 'still alive' messages.
Complete the progess sending.
Tell recipient whether percentage or keepalive is sent, the id and name might be helpfull, and maybe tell whether task is abortable or not; i.e extend the ReceiverFnc signature.
Definition at line 135 of file ProgressData.h.
typedef long long zypp::ProgressData::value_type |
Definition at line 138 of file ProgressData.h.
typedef function<bool( const ProgressData & )> zypp::ProgressData::ReceiverFnc |
Most simple version of progress reporting The percentage in most cases.
Sometimes just keepalive. sender
ProgressData object who sends the progress info
Definition at line 144 of file ProgressData.h.
|
private |
Enumerator | |
---|---|
INIT | |
RUN | |
END |
Definition at line 147 of file ProgressData.h.
|
inline |
Ctor no range [0,0](0)
.
Definition at line 176 of file ProgressData.h.
|
inline |
Ctor [0,max](0)
.
Definition at line 181 of file ProgressData.h.
|
inline |
Ctor [min,max](min)
.
Definition at line 186 of file ProgressData.h.
|
inline |
Ctor [min,max](val)
.
Definition at line 191 of file ProgressData.h.
|
inline |
Definition at line 195 of file ProgressData.h.
|
inline |
Set new min
value.
Definition at line 206 of file ProgressData.h.
|
inline |
Set new max
value.
Definition at line 210 of file ProgressData.h.
|
inline |
Set no range [0,0]
.
Definition at line 214 of file ProgressData.h.
|
inline |
Set new [0,max]
.
Definition at line 218 of file ProgressData.h.
|
inline |
Set new [min,max]
.
Definition at line 222 of file ProgressData.h.
|
inline |
Set counter name.
Definition at line 227 of file ProgressData.h.
|
inline |
Set ReceiverFnc.
Definition at line 231 of file ProgressData.h.
|
inline |
Set no ReceiverFnc.
Definition at line 235 of file ProgressData.h.
|
inline |
Set new counter value
.
Definition at line 251 of file ProgressData.h.
|
inline |
Increment counter value
(default by 1).
Definition at line 258 of file ProgressData.h.
|
inline |
Decrement counter value
(default by 1).
Definition at line 262 of file ProgressData.h.
|
inline |
Set counter value to current min
value.
Definition at line 266 of file ProgressData.h.
|
inline |
Set counter value to current max
value (unless no range).
Definition at line 270 of file ProgressData.h.
|
inline |
Leave counter value unchanged (still alive).
Definition at line 274 of file ProgressData.h.
|
inline |
min
value. Definition at line 284 of file ProgressData.h.
|
inline |
max
value. Definition at line 288 of file ProgressData.h.
|
inline |
value
. Definition at line 292 of file ProgressData.h.
|
inline |
[min,max]
defines a nonempty range. Definition at line 296 of file ProgressData.h.
|
inline |
Definition at line 303 of file ProgressData.h.
|
inline |
false
. Definition at line 310 of file ProgressData.h.
|
inline |
Definition at line 316 of file ProgressData.h.
|
inline |
Definition at line 320 of file ProgressData.h.
|
inline |
Definition at line 324 of file ProgressData.h.
|
inline |
true
if this the final report sent by the ProgressData dtor. Definition at line 330 of file ProgressData.h.
|
private |
Send report if necessary.
Definition at line 33 of file ProgressData.cc.
|
related |
Stream output
Definition at line 107 of file ProgressData.cc.
|
related |
Setup from InputStream.
Definition at line 125 of file ProgressData.cc.
|
private |
Pointer to data.
Definition at line 340 of file ProgressData.h.