impl unit loading in task

master
Chris Punches 2017-06-25 18:39:41 -04:00
parent 27257f98e1
commit 2724cf71a4
3 changed files with 24 additions and 7 deletions

View File

@ -1,7 +1,16 @@
{ {
"units": [ "units": [
{ {
"name": "independent test", "name": "independent test 1",
"target": "/bin/pwd",
"output": "pass",
"rectifier": "/bin/pwd",
"active": true,
"required": true,
"rectify": true
},
{
"name": "independent test 2",
"target": "/bin/pwd", "target": "/bin/pwd",
"output": "pass", "output": "pass",
"rectifier": "/bin/pwd", "rectifier": "/bin/pwd",

View File

@ -39,9 +39,21 @@ void Task::load_root(Json::Value loader_root, bool verbose )
} }
} }
/// Task::get_name - Retrieves the name of the current Task.
std::string Task::get_name() std::string Task::get_name()
{ {
return this->name; return this->name;
} }
/// Task::load_definition - Loads a unit to a local member. Used to tie Units to Tasks.
///
/// \param selected_unit - The unit to attach.
/// \param verbose - Whether to print to STDOUT.
void Task::load_definition( Unit selected_unit, bool verbose )
{
this->definition = selected_unit;
if ( verbose )
{
std::cout << "Loaded definition \"" << selected_unit.get_name() << "\" for task \"" << this->get_name() << "\"." << std::endl;
}
}

View File

@ -28,12 +28,8 @@ class Task
// load a json::value into task members (second stage deserialization) // load a json::value into task members (second stage deserialization)
void load_root( Json::Value loader_root, bool verbose ); void load_root( Json::Value loader_root, bool verbose );
// register a dependency
void add_dependency( std::string dependency_name );
// appends definition unit as child member // appends definition unit as child member
void load_definition( Unit definition ); void load_definition( Unit definition, bool verbose );
bool is_complete(); bool is_complete();