MUQ
0.4.3
WaitBar.cpp
Go to the documentation of this file.
1
#include "
MUQ/Utilities/WaitBar.h
"
2
#include <stdio.h>
3
#include <iostream>
4
5
using namespace
muq::Utilities
;
6
7
WaitBar::WaitBar
(
double
minValIn,
double
maxValIn) : minVal(minValIn), maxVal(maxValIn)
8
{
9
Update
(
minVal
);
10
}
11
12
void
WaitBar::Complete
()
13
{
14
std::cout << std::endl;
15
}
16
17
void
WaitBar::Update
(
double
newVal)
18
{
19
double
perc = (newVal-
minVal
)/(
maxVal
-
minVal
);
20
int
pos = double(
barWidth
) * perc ;
21
22
printf(
"["
);
23
for
(
int
i=0; i<pos; ++i)
24
printf(
"="
);
25
26
printf(
">"
);
27
28
for
(
int
i=pos+1; i<
barWidth
; ++i)
29
printf(
" "
);
30
31
printf(
"] %3.1f%% \r"
, (perc*100.0));
32
33
std::cout << std::flush;
34
}
WaitBar.h
muq::Utilities::WaitBar::maxVal
double maxVal
Definition:
WaitBar.h:19
muq::Utilities::WaitBar::Complete
void Complete()
Definition:
WaitBar.cpp:12
muq::Utilities::WaitBar::Update
void Update(double newVal)
Definition:
WaitBar.cpp:17
muq::Utilities::WaitBar::barWidth
const int barWidth
Definition:
WaitBar.h:21
muq::Utilities::WaitBar::WaitBar
WaitBar(double minValIn, double maxValIn)
Definition:
WaitBar.cpp:7
muq::Utilities::WaitBar::minVal
double minVal
Definition:
WaitBar.h:19
muq::Utilities
Definition:
AllClassWrappers.h:7
doxygen_prep
modules
Utilities
src
WaitBar.cpp
Generated on Wed Jun 12 2024 00:48:28 for MUQ by
1.9.1