From f17a19fe573796b40e644ae04de963168c033d81 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 10 Nov 2015 13:27:32 -0500 Subject: [PATCH] core/idle: Move idle_progress() out of the idle namespace Signed-off-by: Anna Schumaker --- core/idle.cpp | 2 +- gui/manager.cpp | 2 +- include/core/idle.h | 12 ++++-------- tests/core/idle.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/core/idle.cpp b/core/idle.cpp index 0dc3b708..c5ef914c 100644 --- a/core/idle.cpp +++ b/core/idle.cpp @@ -41,7 +41,7 @@ bool idle :: run_task() return false; } -float idle :: get_progress() +float idle_progress() { if (idle_queue.size() == 0) return 1.0; diff --git a/gui/manager.cpp b/gui/manager.cpp index 3ecfce81..adc8b00d 100644 --- a/gui/manager.cpp +++ b/gui/manager.cpp @@ -109,7 +109,7 @@ static bool on_idle() if (ret) { c_progress->show(); - c_progress->set_fraction(idle :: get_progress()); + c_progress->set_fraction(idle_progress()); } else c_progress->hide(); diff --git a/include/core/idle.h b/include/core/idle.h index 76077d70..75c2bb73 100644 --- a/include/core/idle.h +++ b/include/core/idle.h @@ -84,16 +84,12 @@ namespace idle */ bool run_task(); - /** - * Use the values of the queued and serviced counters to find the - * overall process of the idle queue (serviced / queued). - * - * @return The percentage of IdleTasks that have been run. - */ - float get_progress(); - }; + +/* Called to find the percentage of idle tasks that have been run. */ +float idle_progress(); + #include "idle.hpp" #endif /* OCARINA_CORE_IDLE_H */ diff --git a/tests/core/idle.cpp b/tests/core/idle.cpp index aaa043a0..fa1f43c6 100644 --- a/tests/core/idle.cpp +++ b/tests/core/idle.cpp @@ -20,21 +20,21 @@ static void test_idle_queue(unsigned int n) { cur = -1; - test_equal(idle :: get_progress(), (float)1.0); + test_equal(idle_progress(), (float)1.0); test_equal(idle :: run_task(), false); for (float i = 0; i < n; i++) idle :: schedule(inc_cur, i); - test_equal(idle :: get_progress(), (float)0.0); + test_equal(idle_progress(), (float)0.0); for (unsigned int i = 0; i < (n - 1); i++) { test_loop_equal(idle :: run_task(), true, i); - test_loop_equal(idle :: get_progress(), ((i + 1) / (float)n), i); + test_loop_equal(idle_progress(), ((i + 1) / (float)n), i); test_loop_equal(func_passed, true, i); } test_loop_passed(); test_equal(idle :: run_task(), false); - test_equal(idle :: get_progress(), (float)1.0); + test_equal(idle_progress(), (float)1.0); }