diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 97528dc..a316d56 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -33,8 +33,8 @@
-
-
+
+
@@ -42,29 +42,12 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -86,10 +69,55 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -99,7 +127,7 @@
-
+
@@ -120,10 +148,10 @@
+
-
@@ -180,24 +208,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -467,12 +477,12 @@
1491540343823
-
+
-
+
@@ -487,16 +497,17 @@
-
-
+
-
-
+
+
+
+
@@ -504,7 +515,6 @@
-
@@ -583,20 +593,9 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
@@ -605,155 +604,34 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -779,5 +657,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cmake-build-debug/CMakeFiles/ftests.dir/examplar.cpp.o b/cmake-build-debug/CMakeFiles/ftests.dir/examplar.cpp.o
index 09bd1cc..e79880d 100644
Binary files a/cmake-build-debug/CMakeFiles/ftests.dir/examplar.cpp.o and b/cmake-build-debug/CMakeFiles/ftests.dir/examplar.cpp.o differ
diff --git a/cmake-build-debug/CMakeFiles/ftests.dir/src/loaders.cpp.o b/cmake-build-debug/CMakeFiles/ftests.dir/src/loaders.cpp.o
index 4d063fd..f83c06d 100644
Binary files a/cmake-build-debug/CMakeFiles/ftests.dir/src/loaders.cpp.o and b/cmake-build-debug/CMakeFiles/ftests.dir/src/loaders.cpp.o differ
diff --git a/cmake-build-debug/ftests b/cmake-build-debug/ftests
index 590e20f..0becb8e 100755
Binary files a/cmake-build-debug/ftests and b/cmake-build-debug/ftests differ
diff --git a/examplar.cpp b/examplar.cpp
index 60d4233..a2c0b25 100644
--- a/examplar.cpp
+++ b/examplar.cpp
@@ -8,9 +8,10 @@ int main()
UnitHolder unitHolder = UnitHolder( configuration.get_units_path() );
Plan plan = Plan( configuration.get_plan_path() );
+
for ( int i = 0; i < plan.tasks.size(); ++i )
{
- std::cout << plan.tasks[i].get_name() << std::endl;
+ std::cout << unitHolder.select_unit( plan.tasks[i].get_name() ).get_target() << std::endl;
}
diff --git a/src/loaders.cpp b/src/loaders.cpp
index c8c97c9..95fb0ad 100644
--- a/src/loaders.cpp
+++ b/src/loaders.cpp
@@ -68,6 +68,23 @@ UnitHolder::UnitHolder( std::string filename ): JLoader( filename )
}
};
+Unit UnitHolder::select_unit(std::string name)
+{
+ /*
+ * TODO: Implement fetch unit by name method.
+ */
+ for ( int i = 0; i < this->units.size(); ++i )
+ {
+ if ( this->units[i].get_name() == name )
+ {
+ return this->units[i];
+ } else {
+ std::cerr << "Logic error in UnitHolder::select_unit. This is a bug. Please report it." << std::endl;
+ exit(1);
+ }
+ }
+}
+
Task::Task( Json::Value loader_root )
{
@@ -79,6 +96,10 @@ Json::Value Task::get_dependencies() { return this->dependencies;}
Plan::Plan( std::string filename ): JLoader( filename )
{
+/* Plan loads a file and deserializes the Unit JSON object to Task types as a vector member
+ * Plan { vector }
+ * TODO: Ensure FIFO order.
+ */
Json::Value raw_tasks = this->get_root()["plan"];
for ( int index = 0; index < raw_tasks.size(); index++ )
diff --git a/src/loaders.h b/src/loaders.h
index e329b57..8686856 100644
--- a/src/loaders.h
+++ b/src/loaders.h
@@ -50,6 +50,7 @@ class UnitHolder: public JLoader
using JLoader::JLoader;
std::vector units;
UnitHolder( std::string filename );
+ Unit select_unit( std::string name );
};
class Task