implemented plan and task
This commit is contained in:
@@ -35,6 +35,7 @@ Json::Value JLoader::get_root()
|
||||
return this->json_root;
|
||||
}
|
||||
|
||||
|
||||
Unit::Unit( Json::Value loader_root )
|
||||
{
|
||||
this->name = loader_root.get("name", "?").asString();
|
||||
@@ -45,6 +46,7 @@ Unit::Unit( Json::Value loader_root )
|
||||
this->required = loader_root.get("required", "?").asString();
|
||||
this->rectify = loader_root.get("rectify", "?").asString();
|
||||
}
|
||||
|
||||
std::string Unit::get_name() { return this->name; }
|
||||
std::string Unit::get_target() { return this->target; }
|
||||
std::string Unit::get_output() { return this->output; }
|
||||
@@ -62,15 +64,30 @@ UnitHolder::UnitHolder( std::string filename ): JLoader( filename )
|
||||
|
||||
for ( int index = 0; index < raw_units.size(); index++ )
|
||||
{
|
||||
this->Units.push_back(Unit( raw_units[index] ));
|
||||
this->units.push_back(Unit( raw_units[index] ));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Task::Task( Json::Value loader_root )
|
||||
{
|
||||
this->name = loader_root.get("name", "?").asString();
|
||||
this->dependencies = loader_root.get("depends on", "");
|
||||
}
|
||||
std::string Task::get_name() { return this->name; }
|
||||
Json::Value Task::get_dependencies() { return this->dependencies;}
|
||||
|
||||
Plan::Plan( std::string filename ): JLoader( filename )
|
||||
{
|
||||
// TODO: Implement
|
||||
Json::Value raw_tasks = this->get_root()["plan"];
|
||||
|
||||
for ( int index = 0; index < raw_tasks.size(); index++ )
|
||||
{
|
||||
this->tasks.push_back( Task( raw_tasks[index] ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Conf::Conf( std::string filename ): JLoader( filename )
|
||||
{
|
||||
this->plan_path = this->get_root()["plan_path"].asString();
|
||||
|
||||
@@ -46,18 +46,29 @@ class Unit
|
||||
|
||||
class UnitHolder: public JLoader
|
||||
{
|
||||
private:
|
||||
std::vector<Unit> Units;
|
||||
|
||||
public:
|
||||
using JLoader::JLoader;
|
||||
std::vector<Unit> units;
|
||||
UnitHolder( std::string filename );
|
||||
};
|
||||
|
||||
class Task
|
||||
{
|
||||
private:
|
||||
std::string name;
|
||||
Json::Value dependencies;
|
||||
|
||||
public:
|
||||
Task( Json::Value loader_root );
|
||||
std::string get_name();
|
||||
Json::Value get_dependencies();
|
||||
};
|
||||
|
||||
class Plan: public JLoader
|
||||
{
|
||||
public:
|
||||
using JLoader::JLoader;
|
||||
std::vector<Task> tasks;
|
||||
Plan( std::string filename );
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user