Chris Beaumont's IDL Library

Download source code

single page | use frames     summary     class     fields     routine details     file attributes

./

looplister__define.pro

The loopLister object class provides a standard way to provide status updates during long looping operations. A loopLister object is used as follows:

;- create the object list = obj_new('looplister', numIterations, reportFrequency)

for i = 0, numIterations, 1 do begin list->report, i <other code here> endfor

;- destroy the object obj_destroy, list

At each invocation of the method list->report, the list object checks to see if more than reportFrequency seconds have passed since its last report. If so, then it prints some information about how much time has elapsed and remains in the looping process. Note that, as with all objects, the obj_destroy procedure must be called to dispose of the object when it is done. Otherwise, it hangs around and can take up memory (use heap_gc to delete all unused objects)

Class description for looplister

Routines

looplister::report, index [, out=out]

Report how the loop is progressing, if enough time has passed since the last report.

result = looplister::init(iterLimit, frequency [, label=label])

Setup the looplister object

looplister__define

Definition of the looplister class data

Routine details

toplooplister::report

looplister::report, index [, out=out]

Report how the loop is progressing, if enough time has passed since the last report.

Parameters

index in required

The current loop variable value

Keywords

out in optional

A variable to hold the reported message as a string. If this keyword is present, then nothing will be printed to the screen.

Author information

History:

Early 2009: Written by Chris Beaumont June 2009: Added out keyword. cnb. Oct 2009: If it is not yet time to report, the OUT variable is reset to an empty string. This was done to make looplister work nicely with verbiage

toplooplister::init

result = looplister::init(iterLimit, frequency [, label=label])

Setup the looplister object

Return value

1, for success

Parameters

iterLimit in required

the value of the iteration variable which terminates iteration

frequency in required

The number of seconds that should pass between each progress report. If the report method is called more frequently than this number, all intermediate invocations will produce no output

Keywords

label in optional

A user supplied label, which looplister will produce at each report.

Author information

History:

Early 2009: Written by Chris Beaumont June 2009: Fixed bug that caused a crash when obj_new was invoked from the main level. cnb. Oct 2009: Fixed bug that caused report times to drift around during long loops. Removed START keyword

toplooplister__define

looplister__define

Definition of the looplister class data

File attributes

Modifcation date: Mon Mar 22 16:17:13 2010
Lines: 154