rex/examplar.cpp

42 lines
1.6 KiB
C++
Raw Normal View History

2017-04-18 23:04:21 +00:00
#include <iostream>
#include "src/json/json.h"
2017-04-22 12:07:11 +00:00
#include "src/loaders/loaders.h"
2017-04-18 23:04:21 +00:00
int main()
{
// A Plan is made up of Tasks, and a Suite is made up of Units.
// A Plan declares what units are executed and a Suite declares the definitions of those units.
2017-04-19 05:50:34 +00:00
Conf configuration = Conf("config.json");
// load the configuration file which contains filepaths to definitions of a plan and definitions of units.
std::string definitions_file = configuration.get_units_path();
std::string plan_file = configuration.get_plan_path();
2017-04-19 06:27:54 +00:00
Suite unit_definitions = Suite( definitions_file );
Plan plan = Plan( plan_file );
for ( int i = 0; i < plan.num_tasks(); ++i )
2017-04-19 05:50:34 +00:00
{
Task current_task = plan.get_task(i);
Unit current_unit = unit_definitions.get_unit(current_task.get_name());
std::cout << "Found task name in \"" << configuration.get_plan_path() << "\":\t" << current_task.get_name() << std::endl << std::endl;
std::cout << "Associated Unit name:\t\t" << current_unit.get_name() << std::endl;
std::cout << "Associated Unit target:\t\t" << current_unit.get_target() << std::endl;
std::cout << "Associated Unit healer:\t\t" << current_unit.get_rectifier() << std::endl;
std::cout << "Associated Unit heals:\t\t" << current_unit.get_rectify() << std::endl;
Json::Value deps = current_task.get_dependencies();
for ( int j = 0; j < deps.size(); ++j )
{
std::cout << "Associated Dependency:\t\t" << deps[j] << std::endl;
}
std::cout << std::endl;
2017-04-19 05:54:34 +00:00
}
2017-04-19 05:50:34 +00:00
2017-04-18 23:04:21 +00:00
return 0;
}