CoreNEURON
|
progressbar – a C class (by convention) for displaying progress on the command line (to stderr).
Definition in file progressbar.hpp.
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Classes | |
struct | progressbar |
Progressbar data structure (do not modify or create directly) More... | |
Functions | |
progressbar * | progressbar_new (const char *label, unsigned long max) |
Create a new progressbar with the specified label and number of steps. More... | |
progressbar * | progressbar_new_with_format (const char *label, unsigned long max, const char *format) |
Create a new progressbar with the specified label, number of steps, and format string. More... | |
void | progressbar_free (progressbar *bar) |
Free an existing progress bar. Don't call this directly; call progressbar_finish instead. More... | |
void | progressbar_inc (progressbar *bar, double t) |
Increment the given progressbar. Don't increment past the initialized # of steps, though. More... | |
void | progressbar_update (progressbar *bar, unsigned long value, double t) |
Set the current status on the given progressbar. More... | |
void | progressbar_update_label (progressbar *bar, const char *label) |
Set the label of the progressbar. More... | |
void | progressbar_finish (progressbar *bar) |
Finalize (and free!) a progressbar. More... | |
void progressbar_finish | ( | progressbar * | bar | ) |
Finalize (and free!) a progressbar.
Call this when you're done, or if you break out partway through.
Finalize (and free!) a progressbar.
Definition at line 245 of file progressbar.cpp.
void progressbar_free | ( | progressbar * | bar | ) |
Free an existing progress bar. Don't call this directly; call progressbar_finish instead.
Free an existing progress bar. Don't call this directly; call progressbar_finish instead.
Definition at line 99 of file progressbar.cpp.
void progressbar_inc | ( | progressbar * | bar, |
double | t | ||
) |
Increment the given progressbar. Don't increment past the initialized # of steps, though.
Increment the given progressbar. Don't increment past the initialized # of steps, though.
Definition at line 149 of file progressbar.cpp.
progressbar* progressbar_new | ( | const char * | label, |
unsigned long | max | ||
) |
Create a new progressbar with the specified label and number of steps.
label | The label that will prefix the progressbar. |
max | The number of times the progressbar must be incremented before it is considered complete, or, in other words, the number of tasks that this progressbar is tracking. |
Create a new progressbar with the specified label and number of steps.
Definition at line 88 of file progressbar.cpp.
progressbar* progressbar_new_with_format | ( | const char * | label, |
unsigned long | max, | ||
const char * | format | ||
) |
Create a new progressbar with the specified label, number of steps, and format string.
label | The label that will prefix the progressbar. |
max | The number of times the progressbar must be incremented before it is considered complete, or, in other words, the number of tasks that this progressbar is tracking. |
format | The format of the progressbar. The string provided must be three characters, and it will be interpretted with the first character as the left border of the bar, the second character of the bar and the third character as the right border of the bar. For example, "<->" would result in a bar formatted like "<------ >". |
Create a new progressbar with the specified label, number of steps, and format string.
Note that format
must be exactly three characters long, e.g. "<->" to render a progress bar like "<---------->". Returns nullptr if there isn't enough memory to allocate a progressbar
Definition at line 60 of file progressbar.cpp.
void progressbar_update | ( | progressbar * | bar, |
unsigned long | value, | ||
double | t | ||
) |
Set the current status on the given progressbar.
Set the current status on the given progressbar.
Additionally issues a redraw in case a certain time interval has elapsed (min: 1sec) Reasons for a larger interval are:
Definition at line 110 of file progressbar.cpp.
void progressbar_update_label | ( | progressbar * | bar, |
const char * | label | ||
) |
Set the label of the progressbar.
Note that no rendering is done. The label is simply set so that the next rendering will use the new label. To immediately see the new label, call progressbar_draw. Does not update display or copy the label
Definition at line 92 of file progressbar.cpp.