From 24ab0f396fd6eeef745a84e32aea82ecc4017142 Mon Sep 17 00:00:00 2001 From: Chris Punches Date: Fri, 23 Jun 2017 16:02:19 -0400 Subject: [PATCH] plan header reworked --- examplar.cpp | 2 +- src/loaders/Plan.cpp | 11 +++++------ src/loaders/Plan.h | 12 +++++++++--- src/loaders/loaders.h | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/examplar.cpp b/examplar.cpp index 92d858a..63658ad 100644 --- a/examplar.cpp +++ b/examplar.cpp @@ -17,7 +17,7 @@ int main( ) Suite available_definitions; available_definitions.load_units_file( definitions_file, verbose ); -// Plan plan = Plan( plan_file ); + Plan plan; /* for ( int i = 0; i < plan.num_tasks(); ++i ) { diff --git a/src/loaders/Plan.cpp b/src/loaders/Plan.cpp index dd0691b..4c9061e 100644 --- a/src/loaders/Plan.cpp +++ b/src/loaders/Plan.cpp @@ -1,5 +1,5 @@ #include "Plan.h" -/* + int Plan::num_tasks() // returns the number of tasks in a Plan { @@ -13,10 +13,10 @@ Task Plan::get_task(int index) } Task Plan::get_task(std::string provided_name) - * returns a task from a Plan object by name +/* returns a task from a Plan object by name * this will need reworked. maybe should return int, populate a pointer. * error handling is the concern here. - +*/ { Task * returnable; bool foundMatch = false; @@ -41,9 +41,8 @@ Task Plan::get_task(std::string provided_name) } 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 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 ); diff --git a/src/loaders/Plan.h b/src/loaders/Plan.h index daf3d8f..a45c701 100644 --- a/src/loaders/Plan.h +++ b/src/loaders/Plan.h @@ -10,12 +10,18 @@ class Plan: public JSON_Loader { private: + // storage for the tasks that make up the plan std::vector tasks; public: - Plan( std::string filename ); - Task get_task(std::string provided_name); - Task get_task(int index); + Plan(); + + void load_plan_file( std::string filename, bool verbose ); + + void get_task(Task & result, std::string provided_name, bool verbose); + + void get_task(Task & result, int index. bool verbose); + int num_tasks(); }; diff --git a/src/loaders/loaders.h b/src/loaders/loaders.h index 86085b4..e0b7261 100644 --- a/src/loaders/loaders.h +++ b/src/loaders/loaders.h @@ -6,7 +6,7 @@ #include "JSON_Loader.h" #include "Suite.h" -//#include "Plan.h" +#include "Plan.h" #include "Conf.h" #endif //FTESTS_LOADERS_H