Loading...
Searching...
No Matches
casacore::ProgressMeter Class Reference
casa package (libcasa_casa) » System_module

More...

`#include <ProgressMeter.h>`

## Public Member Functions

| ProgressMeter ()
| Makes a null progress meter, i.e.
| ProgressMeter (Double min, Double max, const String &title, const String &subtitle, const String &minlabel, const String &maxlabel, Bool estimateTime=True, Int updateEvery=1)
| Create a progress meter with the given min and max values and labels.
| ProgressMeter (Double min, Double max, const String &title)
| ~ProgressMeter ()
| The destruction of the meter will cause an update to be sent with the maximum value.
void | update (Double value, Bool force=False)
void | _update (Double value, Bool force=False)
void | busy ()
void | done ()
Double | min () const
| Display the min and max values of the progress meter.
Double | max () const

## Static Public Attributes

static const char * | PROGRESSFILE

## Private Member Functions

| ProgressMeter (const ProgressMeter &)
| Undefined and inaccessible.
ProgressMeter & | operator= (const ProgressMeter &)

## Private Attributes

Int | id_p
Double | min_p
Double | max_p
Int | update_every_p
Int | update_count_p
time_t | startTime
| Time the progress meter began.
Bool | showProgress

## Static Private Attributes

static Int(* | creation_function_p )(Double, Double, const String &, const String &, const String &, const String &, Bool)
| These are set by ObjectController for executables that have the tasking system in them, otherwise they are null and this class just does no-ops.
static void(* | update_function_p )(Int, Double)
static void(* | show_function_p )(Int, Double)
static void(* | busy_function_p )(Int)
static void(* | done_function_p )(Int)

## Friends

class | ObjectController

## Detailed Description

Visual indication of a tasks progress.

### Intended use:

Public interface

### Review Status

Date Reviewed:
  yyyy/mm/dd

### Synopsis

This class is used to provide a visual indication to the user of the progress of his task. If the process is not connected to the DO system, calls to the progress meter are NO-OP's, so you can safely use this class in general library code and it won't cause problems for processes which are not attached to the distributed object system. It also won't cause any extra stuff to be linked in to your executable in this case.

The progress meter will usually be removed from the screen once the maximum value is set, so you should not reuse the ProgressMeter after that has happened. It is harmless, but it will not result in any visual feedback for the user.

While the "min" is usually less than "max", if in fact it is greater than "max" the progress meter will count down correctly.

### Example

void calculate(uInt n) {
Int skip = n / 200;
ProgressMeter meter(0, n, "Title", "Subtitle", "", "", True, skip);
for (uInt i=0; i<n; i++) {
... calculate..\.
meter.update(i);
}
}
casacore::ProgressMeter::ProgressMeter
ProgressMeter()
Makes a null progress meter, i.e.
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Int
int Int
Definition aipstype.h:48
casacore::True
const Bool True
Definition aipstype.h:41

### Motivation

Give the user visual indication of a long-running tasks progress.

### To Do

- When the upper bound isn't known, it might be useful to have a busy bar that just moves back and forth to show that activity is happening.
- We should probably have some way to suppress progress bars for tasks that are only going to take a few seconds.

Definition at line 88 of file ProgressMeter.h.

## Constructor & Destructor Documentation

## ProgressMeter() [1/4]

casacore::ProgressMeter::ProgressMeter | ( |  | ) |

Makes a null progress meter, i.e.

no updates to the screen are generated.

Referenced by operator=(), and ProgressMeter().

## ProgressMeter() [2/4]

casacore::ProgressMeter::ProgressMeter | ( | Double | min,
|  | Double | max,
|  | const String & | title,
|  | const String & | subtitle,
|  | const String & | minlabel,
|  | const String & | maxlabel,
|  | Bool | estimateTime = True,
|  | Int | updateEvery = 1 )

Create a progress meter with the given min and max values and labels.

if estimateTime is True, an estimate of the time remaining will be made for the user. This estimate assumes that the remaining portion will compute at the same rate as the portion completed so far, so the time should not be estimated for processes which are non-linear.

Any labels which are set to the empty string will have sensible defaults supplied. In particular, minlabel and maxlabel will be set to the display the minimum and maximum values.

Normally the progress bar will be updated with every call to update(). If however you will be sending many events then you might want to update the GUI every updateEvery'th event for efficiency. Generally there's no point updating more than a couple of hundred times since the eye can't distinguish differences in the progress bar position at that level. If updateEvery is <=0, it is set to 1 for you.

References max(), min(), and casacore::True.

## ProgressMeter() [3/4]

casacore::ProgressMeter::ProgressMeter | ( | Double | min,
|  | Double | max,
|  | const String & | title )

References max(), and min().

## ~ProgressMeter()

casacore::ProgressMeter::~ProgressMeter | ( |  | ) |

The destruction of the meter will cause an update to be sent with the maximum value.

This will usually cause the GUI window to be removed from the screen. Thus the progress meter should generally live as long as the calculation it is tracking.

## ProgressMeter() [4/4]

casacore::ProgressMeter::ProgressMeter | ( | const ProgressMeter & |  | ) |

private

Undefined and inaccessible.

References ProgressMeter().

## Member Function Documentation

## _update()

void casacore::ProgressMeter::_update | ( | Double | value,
|  | Bool | force = False )

References casacore::False, and casacore::NewDelAllocator< T >::value.

## busy()

void casacore::ProgressMeter::busy | ( |  | ) |

## done()

void casacore::ProgressMeter::done | ( |  | ) |

## max()

Double casacore::ProgressMeter::max | ( |  | ) | const

Referenced by ProgressMeter(), and ProgressMeter().

## min()

Double casacore::ProgressMeter::min | ( |  | ) | const

Display the min and max values of the progress meter.

Referenced by ProgressMeter(), and ProgressMeter().

## operator=()

ProgressMeter & casacore::ProgressMeter::operator= | ( | const ProgressMeter & |  | ) |

private

References ProgressMeter().

## update()

void casacore::ProgressMeter::update | ( | Double | value,
|  | Bool | force = False )

References casacore::False, and casacore::NewDelAllocator< T >::value.

## Friends And Related Symbol Documentation

## ObjectController

friend class ObjectController

friend

Definition at line 136 of file ProgressMeter.h.

References ObjectController.

Referenced by ObjectController.

## Member Data Documentation

## busy_function_p

void(* casacore::ProgressMeter::busy_function_p) (Int)

static private

Definition at line 154 of file ProgressMeter.h.

## creation_function_p

Int(* casacore::ProgressMeter::creation_function_p) (Double, Double, const String &, const String &, const String &, const String &, Bool)

static private

These are set by ObjectController for executables that have the tasking system in them, otherwise they are null and this class just does no-ops.

Definition at line 148 of file ProgressMeter.h.

## done_function_p

void(* casacore::ProgressMeter::done_function_p) (Int)

static private

Definition at line 155 of file ProgressMeter.h.

## id_p

Int casacore::ProgressMeter::id_p

private

Definition at line 139 of file ProgressMeter.h.

## max_p

Double casacore::ProgressMeter::max_p

private

Definition at line 140 of file ProgressMeter.h.

## min_p

Double casacore::ProgressMeter::min_p

private

Definition at line 140 of file ProgressMeter.h.

## PROGRESSFILE

const char* casacore::ProgressMeter::PROGRESSFILE

static

Definition at line 137 of file ProgressMeter.h.

## show_function_p

void(* casacore::ProgressMeter::show_function_p) (Int, Double)

static private

Definition at line 153 of file ProgressMeter.h.

## showProgress

Bool casacore::ProgressMeter::showProgress

private

Definition at line 144 of file ProgressMeter.h.

## startTime

time_t casacore::ProgressMeter::startTime

private

Time the progress meter began.

Definition at line 143 of file ProgressMeter.h.

## update_count_p

Int casacore::ProgressMeter::update_count_p

private

Definition at line 141 of file ProgressMeter.h.

## update_every_p

Int casacore::ProgressMeter::update_every_p

private

Definition at line 141 of file ProgressMeter.h.

## update_function_p

void(* casacore::ProgressMeter::update_function_p) (Int, Double)

static private

Definition at line 152 of file ProgressMeter.h.

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

- casa/System/ProgressMeter.h