worked out dependency type issue
parent
03ff5150ac
commit
1fe0defc7b
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"plan": [
|
||||
{ "name": "independent test", "depends on": null },
|
||||
{ "name": "dependent test", "depends on": [ "independent test", null, null ] }
|
||||
{ "name": "independent test", "dependencies": [ null ] },
|
||||
{ "name": "dependent test", "dependencies": [ "independent test", null, null ] }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void Plan::load_plan_file(std::string filename, bool verbose)
|
|||
Task tmp_T;
|
||||
for ( int index = 0; index < this->json_root.size(); index++ )
|
||||
{
|
||||
tmp_T.load_root( this->json_root[ index ] );
|
||||
tmp_T.load_root( this->json_root[ index ], verbose );
|
||||
this->tasks.push_back( tmp_T );
|
||||
if ( verbose ) {
|
||||
std::cout << "Added task \"" << tmp_T.get_name() << "\" to Plan." << std::endl;
|
||||
|
|
|
@ -13,7 +13,7 @@ Task::Task() {}
|
|||
///
|
||||
/// \param loader_root
|
||||
/// \return
|
||||
void Task::load_root(Json::Value loader_root)
|
||||
void Task::load_root(Json::Value loader_root, bool verbose )
|
||||
{
|
||||
if ( loader_root.isMember("name") )
|
||||
{
|
||||
|
@ -22,7 +22,22 @@ void Task::load_root(Json::Value loader_root)
|
|||
throw Task_InvalidDataStructure();
|
||||
}
|
||||
|
||||
this->dependencies = loader_root.get("depends on", "");
|
||||
// fetch as Json::Value array obj
|
||||
Json::Value des_dep_root = loader_root.get("dependencies", 0);
|
||||
|
||||
// iterate through each member of that obj
|
||||
for ( int i = 0; i < des_dep_root.size(); i++ )
|
||||
{
|
||||
// add each string to dependencies
|
||||
if ( des_dep_root[i].asString() != "" )
|
||||
{
|
||||
this->dependencies.push_back( des_dep_root[i].asString() );
|
||||
if ( verbose ) {
|
||||
std::cout << "Added dependency \"" << des_dep_root[i].asString() << "\" to Task \"" << this->get_name() << "\"." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//this->has_succeeded = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class Task
|
|||
Task();
|
||||
|
||||
// load a json::value into task members (second stage deserialization)
|
||||
void load_root( Json::Value loader_root );
|
||||
void load_root( Json::Value loader_root, bool verbose );
|
||||
|
||||
// register a dependency
|
||||
void add_dependency( std::string dependency_name );
|
||||
|
|
Loading…
Reference in New Issue