MLask 1.0.0
A custom c++ deep learning library
Loading...
Searching...
No Matches
ProgressBar.hpp
Go to the documentation of this file.
1#pragma once
2#include <cstddef>
3#include <iostream>
4
5namespace mlask{
8 inline static const std::size_t size = 100;
9 inline static const std::string title = "LEARNING PROGRESS BAR";
10public:
14 static void draw(float progress){
15 std::cout<<"\033[2J\033[H"; /* clear screen */
16
17 std::cout<<"\033[36m"; /* cyan color */
18 for(std::size_t i=0;i<size-title.length();i++){
19 std::cout<<'-';
20 if (i == (size - title.length())/2){
21 std::cout<<"\033[31m"<<"\033[5m"<<"\033[1m"<<title<<"\033[25m"<<"\033[22m";
22 std::cout<<"\033[36m"; /* cyan color */
23 }
24 }
25 std::cout<<std::endl;
26
27 std::cout<<"\033[92m"; /* green color */
28 progress = (std::size_t)(progress * size);
29 std::size_t i;
30 for(i=0;i<progress;i++){
31 std::cout<<'|';
32 }
33 std::cout<<"\033[31m"; /* red color */
34 for(;i<size;i++){
35 std::cout<<'|';
36 }
37 std::cout<<std::endl;
38
39 std::cout<<"\033[36m"; /* cyan color */
40 for(std::size_t i=0;i<size;i++){
41 std::cout<<'-';
42 }
43 std::cout<<std::endl;
44
45 std::cout<<"\033[0m"; /* reset of styles */
46 }
47};
48}
Class used to write progress bars in the terminal.
Definition ProgressBar.hpp:7
static void draw(float progress)
Draws the progress bar.
Definition ProgressBar.hpp:14
Definition LeakyRelu.hpp:4