Skip to content

Commit

Permalink
Fix multiple bugs + v5.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
odelaneau committed May 8, 2023
1 parent f617325 commit 990ed0d
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 683 deletions.
1 change: 1 addition & 0 deletions common/src/utils/otools.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ using aligned_vector32 = std::vector<T, boost::alignment::aligned_allocator < T,
#define DIV2(v) ((v)>>1)
#define MOD2(v) ((v)&1)
#define DIVU(v, d) (v+(d-1))/d
#define ROUND8(x) ((x+7)>>3)<<3

//NAMESPACE
namespace bio = boost::iostreams;
Expand Down
15 changes: 13 additions & 2 deletions common/src/utils/verbose.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ class verbose {
std::ofstream log;
bool verbose_on_screen;
bool verbose_on_log;
bool verbose_progress;
int prev_percent;

public:
verbose() {
verbose_on_screen = true;
verbose_on_log = false;
verbose_progress = false;
prev_percent = -1;
}

Expand All @@ -61,6 +63,10 @@ class verbose {
verbose_on_screen = false;
}

void show_progress (){
verbose_progress = true;
}

void print(std::string s) {
if (verbose_on_screen) std::cout << s << std::endl;
if (verbose_on_log) log << s << std::endl;
Expand All @@ -86,6 +92,11 @@ class verbose {
if (verbose_on_log) log << " + " << s << std::endl;
}

void bullet3(std::string s) {
if (verbose_on_screen) std::cout << " - " << s << std::endl;
if (verbose_on_log) log << " - " << s << std::endl;
}

void warning(std::string s) {
if (verbose_on_screen) std::cout << std::endl << "\x1B[33m" << "WARNING: " << "\033[0m" << s << std::endl;
if (verbose_on_log) log << std::endl << "WARNING: " << s << std::endl;
Expand All @@ -110,14 +121,14 @@ class verbose {
}

void wait(std::string s) {
if (verbose_on_screen) {
if (verbose_on_screen && verbose_progress) {
std::cout << s << " ...\r";
std::cout.flush();
}
}

void progress(std::string prefix, float percent) {
if (verbose_on_screen) {
if (verbose_on_screen && verbose_progress) {
int curr_percent = int(percent * 100.0);
if (prev_percent > curr_percent) prev_percent = -1;
if (curr_percent > prev_percent) {
Expand Down
Loading

0 comments on commit 990ed0d

Please sign in to comment.