added task state flag

master
Chris Punches 2017-06-25 18:58:05 -04:00
parent 27969c3c27
commit 0bd455dd97
3 changed files with 25 additions and 1 deletions

View File

@ -89,6 +89,9 @@ void Plan::get_task(Task & result, std::string provided_name, bool verbose)
} }
/// Plan::load_definitions - Load the units corresponding to each task in plan from the given Suite. /// Plan::load_definitions - Load the units corresponding to each task in plan from the given Suite.
///
/// \param unit_definitions - The Suite to load definitions from.
/// \param verbose - Whether to print verbose information to STDOUT.
void Plan::load_definitions( Suite unit_definitions, bool verbose ) void Plan::load_definitions( Suite unit_definitions, bool verbose )
{ {
// placeholder Unit // placeholder Unit

View File

@ -7,7 +7,13 @@ class Task_InvalidDataStructure: public std::runtime_error { public:
/// Task::Task() - Constructor for the Task class. The Task is the building block of a Plan indicating of which Unit to /// Task::Task() - Constructor for the Task class. The Task is the building block of a Plan indicating of which Unit to
/// execute, and its dependencies on other units to have already been completed successfully. /// execute, and its dependencies on other units to have already been completed successfully.
Task::Task() {} Task::Task() {
// it hasn't executed yet.
this->complete = false;
// it hasn't been matched with a definition yet.
this->defined = false;
}
/// Task::load_root() - loads json values to private members /// Task::load_root() - loads json values to private members
/// ///
@ -56,4 +62,15 @@ void Task::load_definition( Unit selected_unit, bool verbose )
{ {
std::cout << "Loaded definition \"" << selected_unit.get_name() << "\" for task \"" << this->get_name() << "\"." << std::endl; std::cout << "Loaded definition \"" << selected_unit.get_name() << "\" for task \"" << this->get_name() << "\"." << std::endl;
} }
this->defined = true;
}
/// Task::is_complete - Indicator if the task executed successfully.
bool Task::is_complete() {
return this->complete;
}
/// Task::has_definition - Indicator if the task has attached its definition from a Suite.
bool Task::has_definition() {
return this->defined;
} }

View File

@ -21,6 +21,9 @@ class Task
// the status of this task // the status of this task
bool complete; bool complete;
// the readiness of this task to execute
bool defined;
public: public:
// constructor // constructor
Task(); Task();
@ -32,6 +35,7 @@ class Task
void load_definition( Unit definition, bool verbose ); void load_definition( Unit definition, bool verbose );
bool is_complete(); bool is_complete();
bool has_definition();
// fetch the name of a task // fetch the name of a task
std::string get_name(); std::string get_name();