beginnings of plan and task re-impl

master
Chris Punches 2017-06-23 16:13:44 -04:00
parent 24ab0f396f
commit 9323f465c1
2 changed files with 14 additions and 22 deletions

View File

@ -1,9 +1,19 @@
#include "Plan.h" #include "Plan.h"
int Plan::num_tasks() Plan::Plan(): JSON_Loader() {};
// returns the number of tasks in a Plan
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) Task Plan::get_task(int index)
@ -38,20 +48,4 @@ Task Plan::get_task(std::string provided_name)
} }
return * returnable; 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<Task> }
{
// 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] ) );
}
};
*/

View File

@ -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, std::string provided_name, bool verbose);
void get_task(Task & result, int index. bool verbose); void get_task(Task & result, int index. bool verbose);
int num_tasks();
}; };
#endif //FTESTS_PLAN_H #endif //FTESTS_PLAN_H