diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-07 15:49:40 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-07 15:49:40 -0700 |
commit | 05d177737c980aad2fcdb54765433e02021ab1e0 (patch) | |
tree | 3b146349a2674db7e585f396bfb5eb0062c4ccd9 /038scheduler.cc | |
parent | 0487a30e7078861ed7de42bdb21b5c71fb9b54a1 (diff) | |
download | mu-05d177737c980aad2fcdb54765433e02021ab1e0.tar.gz |
1299 - stop using [] in any vector
Useful check: $ grep "[^ '\"]\[[^\"]" *.cc \ |perl -pwe 's/\Wargv\[|\WTests\[|\Wframe\[|\WMemory\[|\WName\[|\WSurrounding_space\[|\WRecipe\[|\WType\[|\WRecipe_number\[|\WType_number\[|\WBefore_fragments\[|\WAfter_fragments\[//g' \ |perl -pwe 's/\Wargv\[|\WTests\[|\Wframe\[|\WMemory\[|\WName\[|\WSurrounding_space\[|\WRecipe\[|\WType\[|\WRecipe_number\[|\WType_number\[|\WBefore_fragments\[|\WAfter_fragments\[//g' \ |grep '[^ ]\['
Diffstat (limited to '038scheduler.cc')
-rw-r--r-- | 038scheduler.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/038scheduler.cc b/038scheduler.cc index ebc690a0..b8c51e40 100644 --- a/038scheduler.cc +++ b/038scheduler.cc @@ -44,7 +44,7 @@ Scheduling_interval = 500; :(replace{} "void run(recipe_number r)") void run(recipe_number r) { Routines.push_back(new routine(r)); - Current_routine_index = 0, Current_routine = Routines[0]; + Current_routine_index = 0, Current_routine = Routines.at(0); while (!all_routines_done()) { skip_to_next_routine(); //? cout << "scheduler: " << Current_routine_index << '\n'; //? 1 @@ -62,8 +62,8 @@ void run(recipe_number r) { :(code) bool all_routines_done() { for (index_t i = 0; i < Routines.size(); ++i) { -//? cout << "routine " << i << ' ' << Routines[i]->state << '\n'; //? 1 - if (Routines[i]->state == RUNNING) { +//? cout << "routine " << i << ' ' << Routines.at(i)->state << '\n'; //? 1 + if (Routines.at(i)->state == RUNNING) { return false; } } @@ -75,10 +75,10 @@ void skip_to_next_routine() { assert(!Routines.empty()); assert(Current_routine_index < Routines.size()); for (index_t i = (Current_routine_index+1)%Routines.size(); i != Current_routine_index; i = (i+1)%Routines.size()) { - if (Routines[i]->state == RUNNING) { + if (Routines.at(i)->state == RUNNING) { //? cout << "switching to " << i << '\n'; //? 1 Current_routine_index = i; - Current_routine = Routines[i]; + Current_routine = Routines.at(i); return; } } @@ -87,7 +87,7 @@ void skip_to_next_routine() { :(before "End Teardown") for (index_t i = 0; i < Routines.size(); ++i) - delete Routines[i]; + delete Routines.at(i); Routines.clear(); //:: To schedule new routines to run, call 'start-running'. @@ -231,8 +231,8 @@ case ROUTINE_STATE: { index_t id = ingredients.at(0).at(0); long long int result = -1; for (index_t i = 0; i < Routines.size(); ++i) { - if (Routines[i]->id == id) { - result = Routines[i]->state; + if (Routines.at(i)->id == id) { + result = Routines.at(i)->state; break; } } |