|
STORMM Source Documentation
|
Public Member Functions | |
| ProgressBar (int cycle_count_in=0, bool show_bar_in=true, std::ostream &output_in=std::cout) | |
| The constructor for a ProgressBar. | |
| const std::string & | getState () const |
| Get the current state of the progress bar, for inspection. | |
| void | initialize (int n=0, bool show_bar_in=true, std::ostream &out=std::cout) |
| Initializes a new Progress Bar from scratch, taking in user-specified information. To be used when we want to do a hard-refresh on the existing ProgressBar object. | |
| void | reset () |
| Resets the current instance of the ProgressBar object (sets percentage to 0). To be used before a new loop, with every other setting remaining the same. | |
| void | setIterations (int iter) |
| Set a new number of iterations for an existing ProgressBar object. | |
| void | setDoneChar (const std::string &sym) |
| Set a new "done" char for a ProgressBar object. This is the char that appears when a percentage is done in the ProgressBar. | |
| void | setTodoChar (const std::string &sym) |
| Set a new "todo" char for a ProgressBar object. This is the char that populates the remaining of the ProgressBar object. | |
| void | setOpeningBracketChar (const std::string &sym) |
| Set a new opening bracket for a ProgressBar object. This is the char during the start of a ProgressBar object. | |
| void | setClosingBracketChar (const std::string &sym) |
| Set a new closing bracket for a ProgressBar object. This is the char to use for a closing char of the bar (default is ']') | |
| void | showBar (bool flag=true) |
| Toggles the visibility of the ProgressBar. Default is true. | |
| void | setOutputStream (std::ostream &stream) |
| Function to set the output stream of the current ProgressBar object. Default is cout, can be changed to any std::ostream &object. | |
| void | setTerminalWidth (int width) |
| Allows the user to set a custom terminal width for the ProgressBar. If this function is called, it will override the dynamically inferred width. | |
| void | allocateBarContents () |
| Function to allocate the bar_contents string for the ProgressBar object. This is called when the bar is first initialized or when the terminal width is changed. | |
| void | update () |
| Function to update the ProgressBar, incrementing the number of iterations by 1, calculating the appropriate percentage, and rendering the ProgressBar in the terminal. | |
| void stormm::reporting::ProgressBar::initialize | ( | int | n = 0, |
| bool | show_bar_in = true, | ||
| std::ostream & | out = std::cout ) |
Initializes a new Progress Bar from scratch, taking in user-specified information. To be used when we want to do a hard-refresh on the existing ProgressBar object.
| out | Determines which C standard output stream to use. Default is cout, can use cerr or C++ methods such as printf. |
| void stormm::reporting::ProgressBar::setDoneChar | ( | const std::string & | sym | ) |
Set a new "done" char for a ProgressBar object. This is the char that appears when a percentage is done in the ProgressBar.
| sym | The string to use for a Done char (default is '#') |
| void stormm::reporting::ProgressBar::setIterations | ( | int | iter | ) |
Set a new number of iterations for an existing ProgressBar object.
| iter | The new number of iterations for the ProgressBar object |
| void stormm::reporting::ProgressBar::setOpeningBracketChar | ( | const std::string & | sym | ) |
Set a new opening bracket for a ProgressBar object. This is the char during the start of a ProgressBar object.
| sym | The string to use for an opening char of the bar (default is '[') |
| void stormm::reporting::ProgressBar::setOutputStream | ( | std::ostream & | stream | ) |
Function to set the output stream of the current ProgressBar object. Default is cout, can be changed to any std::ostream &object.
| stream | The standard output stream to use for rendering the progress bar. |
| void stormm::reporting::ProgressBar::setTerminalWidth | ( | int | width | ) |
Allows the user to set a custom terminal width for the ProgressBar. If this function is called, it will override the dynamically inferred width.
| width | The new width of the terminal in characters |
| void stormm::reporting::ProgressBar::setTodoChar | ( | const std::string & | sym | ) |
Set a new "todo" char for a ProgressBar object. This is the char that populates the remaining of the ProgressBar object.
| sym | The string to use for a Todo char (default is ' ') |
| void stormm::reporting::ProgressBar::showBar | ( | bool | flag = true | ) |
Toggles the visibility of the ProgressBar. Default is true.
| flag | Boolean value to show/hide the ProgressBar. If hidden, the percentage value is still shown. |