![]() |
|
PhoenixThread
1.0.0
Tools to ease parallel programming in C++
|
Deal with Progress bar in mutlithread mode. More...
#include <PMultiThreadProgress.h>
Public Member Functions | |
| size_t | addProgressBar (const PString &name, int progressMax=1) |
| Add a progress line. | |
| void | incrementProgress (size_t index) |
| Increment the progress of the progress bar at index. | |
| bool | isFinished () const |
| Say if the PMultiThreadProgress is finished. | |
| PMultiThreadProgress & | operator= (const PMultiThreadProgress &other) |
| Definition of equal operator of PMultiThreadProgress. | |
| PMultiThreadProgress (const PMultiThreadProgress &other) | |
| Copy constructor of PMultiThreadProgress. | |
| PMultiThreadProgress (size_t nbExpectedProgressBar=1lu) | |
| Default constructor of PMultiThreadProgress. | |
| void | print () |
| Print the multithread progress bar. | |
| void | printSummary () const |
| Print a summary of all the progress bars. | |
| void | setError (size_t index) |
| Mark the progress bar at index finished with an error. | |
| void | setNbExpectedProgressBar (size_t nbExpectedProgressBar) |
| Set the number of expected progress bars in the PMultiThreadProgress. | |
| virtual | ~PMultiThreadProgress () |
| Destructor of PMultiThreadProgress. | |
Protected Member Functions | |
| void | copyPMultiThreadProgress (const PMultiThreadProgress &other) |
| Copy function of PMultiThreadProgress. | |
Private Member Functions | |
| void | eraseProgressBar (size_t nbColTerminal) |
| Erase all progress bars. | |
| size_t | getNbColTerminal () const |
| Get the number of columns in the current terminal. | |
| void | initialisationPMultiThreadProgress (size_t nbExpectedProgressBar) |
| Initialisation function of the class PMultiThreadProgress. | |
| bool | isModified () |
| Check if the PMultiThreadProgress has been modified. | |
| void | printAllFinshedProgressBar () |
| Print all finished progress bars. | |
| void | printProgressBar (size_t nbColTerminal) |
| Print all progress bars. | |
Private Attributes | |
| size_t | p_alreadyPrintedLine |
| Nunmber of already printed line. | |
| std::mutex | p_currentMutex |
| Mutex of the class to avoid conflict manipulation between threads. | |
| size_t | p_nbExpectedProgressBar |
| Number of expected progress bars. | |
| size_t | p_previousNbProgressBar |
| Previous number of progress bars. | |
| VecProgressElement | p_vecProgressElement |
| Vector of pair (progress, between 0 and 100) and name of progress. | |
Deal with Progress bar in mutlithread mode.
Definition at line 36 of file PMultiThreadProgress.h.
| PMultiThreadProgress::PMultiThreadProgress | ( | size_t | nbExpectedProgressBar = 1lu | ) |
Default constructor of PMultiThreadProgress.
| nbExpectedProgressBar | : number of expected progress bars |
Definition at line 29 of file PMultiThreadProgress.cpp.
References initialisationPMultiThreadProgress().
Referenced by copyPMultiThreadProgress(), operator=(), and PMultiThreadProgress().
Here is the call graph for this function:
Here is the caller graph for this function:| PMultiThreadProgress::PMultiThreadProgress | ( | const PMultiThreadProgress & | other | ) |
Copy constructor of PMultiThreadProgress.
| other | : class to copy |
Definition at line 36 of file PMultiThreadProgress.cpp.
References copyPMultiThreadProgress(), and PMultiThreadProgress().
Here is the call graph for this function:
|
virtual |
Destructor of PMultiThreadProgress.
Definition at line 41 of file PMultiThreadProgress.cpp.
| size_t PMultiThreadProgress::addProgressBar | ( | const PString & | name, |
| int | progressMax = 1 ) |
Add a progress line.
| name | : name of the progress line |
| progressMax | : maximum of progression bar |
Definition at line 66 of file PMultiThreadProgress.cpp.
References ProgressElement::isEndError, ProgressElement::name, p_currentMutex, p_vecProgressElement, ProgressElement::prevProgress, ProgressElement::progress, and ProgressElement::progressMax.
Referenced by phoenix_program_callVecProgress().
Here is the caller graph for this function:
|
protected |
Copy function of PMultiThreadProgress.
| other | : class to copy |
Definition at line 127 of file PMultiThreadProgress.cpp.
References p_alreadyPrintedLine, p_nbExpectedProgressBar, p_vecProgressElement, and PMultiThreadProgress().
Referenced by operator=(), and PMultiThreadProgress().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Erase all progress bars.
| nbColTerminal | : number of columns in the current terminal |
Definition at line 161 of file PMultiThreadProgress.cpp.
References p_alreadyPrintedLine, and p_previousNbProgressBar.
Referenced by print().
Here is the caller graph for this function:
|
private |
Get the number of columns in the current terminal.
Definition at line 227 of file PMultiThreadProgress.cpp.
Referenced by print().
Here is the caller graph for this function:| void PMultiThreadProgress::incrementProgress | ( | size_t | index | ) |
Increment the progress of the progress bar at index.
| index | : index of the progress bar to be incremented |
Definition at line 82 of file PMultiThreadProgress.cpp.
References p_vecProgressElement.
Referenced by phoenix_program_callVecProgress().
Here is the caller graph for this function:
|
private |
Initialisation function of the class PMultiThreadProgress.
| nbExpectedProgressBar | : number of expected progress bars |
Definition at line 136 of file PMultiThreadProgress.cpp.
References p_alreadyPrintedLine, p_nbExpectedProgressBar, p_previousNbProgressBar, and p_vecProgressElement.
Referenced by PMultiThreadProgress().
Here is the caller graph for this function:| bool PMultiThreadProgress::isFinished | ( | ) | const |
Say if the PMultiThreadProgress is finished.
Definition at line 96 of file PMultiThreadProgress.cpp.
References p_alreadyPrintedLine, p_nbExpectedProgressBar, and p_vecProgressElement.
Referenced by phoenix_print_parallel_progress().
Here is the caller graph for this function:
|
private |
Check if the PMultiThreadProgress has been modified.
Definition at line 146 of file PMultiThreadProgress.cpp.
References ProgressElement::isEndError, p_alreadyPrintedLine, p_currentMutex, p_vecProgressElement, ProgressElement::prevProgress, and ProgressElement::progress.
Referenced by print().
Here is the caller graph for this function:| PMultiThreadProgress & PMultiThreadProgress::operator= | ( | const PMultiThreadProgress & | other | ) |
Definition of equal operator of PMultiThreadProgress.
| other | : class to copy |
Definition at line 49 of file PMultiThreadProgress.cpp.
References copyPMultiThreadProgress(), and PMultiThreadProgress().
Here is the call graph for this function:| void PMultiThreadProgress::print | ( | ) |
Print the multithread progress bar.
Definition at line 101 of file PMultiThreadProgress.cpp.
References eraseProgressBar(), getNbColTerminal(), isModified(), p_previousNbProgressBar, p_vecProgressElement, printAllFinshedProgressBar(), and printProgressBar().
Referenced by phoenix_print_parallel_progress().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Print all finished progress bars.
Definition at line 204 of file PMultiThreadProgress.cpp.
References ProgressElement::isEndError, ProgressElement::name, p_alreadyPrintedLine, p_currentMutex, p_vecProgressElement, ProgressElement::progress, and ProgressElement::progressMax.
Referenced by print().
Here is the caller graph for this function:
|
private |
Print all progress bars.
| nbColTerminal | : number of columns in the current terminal |
Definition at line 174 of file PMultiThreadProgress.cpp.
References ProgressElement::isEndError, ProgressElement::name, p_alreadyPrintedLine, p_vecProgressElement, ProgressElement::prevProgress, ProgressElement::progress, and ProgressElement::progressMax.
Referenced by print().
Here is the caller graph for this function:| void PMultiThreadProgress::printSummary | ( | ) | const |
Print a summary of all the progress bars.
Definition at line 115 of file PMultiThreadProgress.cpp.
References p_vecProgressElement.
Referenced by phoenix_print_parallel_progress().
Here is the caller graph for this function:| void PMultiThreadProgress::setError | ( | size_t | index | ) |
Mark the progress bar at index finished with an error.
| index | : index of the progress bar to be modified |
Definition at line 89 of file PMultiThreadProgress.cpp.
References p_vecProgressElement.
| void PMultiThreadProgress::setNbExpectedProgressBar | ( | size_t | nbExpectedProgressBar | ) |
Set the number of expected progress bars in the PMultiThreadProgress.
| nbExpectedProgressBar | : number of expected progress bars |
Definition at line 57 of file PMultiThreadProgress.cpp.
References p_nbExpectedProgressBar.
|
private |
Nunmber of already printed line.
Definition at line 65 of file PMultiThreadProgress.h.
Referenced by copyPMultiThreadProgress(), eraseProgressBar(), initialisationPMultiThreadProgress(), isFinished(), isModified(), printAllFinshedProgressBar(), and printProgressBar().
|
private |
Mutex of the class to avoid conflict manipulation between threads.
Definition at line 69 of file PMultiThreadProgress.h.
Referenced by addProgressBar(), isModified(), and printAllFinshedProgressBar().
|
private |
Number of expected progress bars.
Definition at line 73 of file PMultiThreadProgress.h.
Referenced by copyPMultiThreadProgress(), initialisationPMultiThreadProgress(), isFinished(), and setNbExpectedProgressBar().
|
private |
Previous number of progress bars.
Definition at line 71 of file PMultiThreadProgress.h.
Referenced by eraseProgressBar(), initialisationPMultiThreadProgress(), and print().
|
private |
Vector of pair (progress, between 0 and 100) and name of progress.
Definition at line 67 of file PMultiThreadProgress.h.
Referenced by addProgressBar(), copyPMultiThreadProgress(), incrementProgress(), initialisationPMultiThreadProgress(), isFinished(), isModified(), print(), printAllFinshedProgressBar(), printProgressBar(), printSummary(), and setError().