From 9323f465c1d83759f9a66432ce07e152315695d5 Mon Sep 17 00:00:00 2001 From: Chris Punches Date: Fri, 23 Jun 2017 16:13:44 -0400 Subject: [PATCH] beginnings of plan and task re-impl --- src/loaders/Plan.cpp | 34 ++++++++++++++-------------------- src/loaders/Plan.h | 2 -- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/loaders/Plan.cpp b/src/loaders/Plan.cpp index 4c9061e..5bb1245 100644 --- a/src/loaders/Plan.cpp +++ b/src/loaders/Plan.cpp @@ -1,9 +1,19 @@ #include "Plan.h" -int Plan::num_tasks() -// returns the number of tasks in a Plan +Plan::Plan(): JSON_Loader() {}; + +void Plan::load_plan_file(std::string filename, bool verbose) { - return (int)this->tasks.size(); + // plan always loads from file + this->load_json_file( filename ); + + Json::Value raw_tasks = this->as_serialized()["plan"]; + + for ( int index = 0; index < raw_tasks.size(); index++ ) + { + this->tasks.push_back( Task( raw_tasks[index] ) ); + } + } Task Plan::get_task(int index) @@ -38,20 +48,4 @@ Task Plan::get_task(std::string provided_name) } return * returnable; -} - -Plan::Plan( std::string filename ): JSON_Loader() -// Plan loads a file and deserializes the Unit JSON object to Task types as a vector member -// Plan { vector } -{ - // plan always loads from file - this->load_json_file( filename ); - - Json::Value raw_tasks = this->as_serialized()["plan"]; - - for ( int index = 0; index < raw_tasks.size(); index++ ) - { - this->tasks.push_back( Task( raw_tasks[index] ) ); - } -}; -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/src/loaders/Plan.h b/src/loaders/Plan.h index a45c701..b0af61f 100644 --- a/src/loaders/Plan.h +++ b/src/loaders/Plan.h @@ -21,8 +21,6 @@ class Plan: public JSON_Loader void get_task(Task & result, std::string provided_name, bool verbose); void get_task(Task & result, int index. bool verbose); - - int num_tasks(); }; #endif //FTESTS_PLAN_H