diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 207b3f5..107f8ea 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -33,20 +33,18 @@
-
-
-
-
-
+
+
+
-
+
-
-
+
+
@@ -54,31 +52,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -91,164 +69,31 @@
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -263,12 +108,13 @@
-
-
+
-
+
+
+
@@ -375,6 +221,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -589,12 +457,12 @@
1491540343823
-
+
-
+
@@ -617,7 +485,7 @@
-
+
@@ -629,6 +497,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -666,26 +555,36 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
@@ -819,41 +718,29 @@
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/cmake-build-debug/CMakeFiles/ftests.dir/CXX.includecache b/cmake-build-debug/CMakeFiles/ftests.dir/CXX.includecache
index 62a156f..da5ac93 100644
--- a/cmake-build-debug/CMakeFiles/ftests.dir/CXX.includecache
+++ b/cmake-build-debug/CMakeFiles/ftests.dir/CXX.includecache
@@ -9,14 +9,8 @@
/home/phanes/Development/internal/ftests/main.cpp
iostream
-
-fstream
--
src/json/json.h
/home/phanes/Development/internal/ftests/src/json/json.h
-string
--
-src/json/json-forwards.h
-/home/phanes/Development/internal/ftests/src/json/json-forwards.h
src/loaders.h
/home/phanes/Development/internal/ftests/src/loaders.h
@@ -187,14 +181,6 @@ float.h
/home/phanes/Development/internal/ftests/src/loaders.cpp
loaders.h
/home/phanes/Development/internal/ftests/src/loaders.h
-json/json.h
-/home/phanes/Development/internal/ftests/src/json/json.h
-json/json-forwards.h
-/home/phanes/Development/internal/ftests/src/json/json-forwards.h
-iostream
--
-fstream
--
sys/stat.h
-
diff --git a/cmake-build-debug/CMakeFiles/ftests.dir/main.cpp.o b/cmake-build-debug/CMakeFiles/ftests.dir/main.cpp.o
index f853916..237d3cc 100644
Binary files a/cmake-build-debug/CMakeFiles/ftests.dir/main.cpp.o and b/cmake-build-debug/CMakeFiles/ftests.dir/main.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 e5b86c2..2240ae9 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/conf/test.plan b/cmake-build-debug/conf/test.plan
index 6a0bba6..99cbb4d 100644
--- a/cmake-build-debug/conf/test.plan
+++ b/cmake-build-debug/conf/test.plan
@@ -1,6 +1,6 @@
{
- "plan": [
- { "name": "gcc is present", "depends on": [ null ] },
- { "name": "gcYou are not c can compile", "depends on": [ "gcc is present" ] }
- ]
-}
+ "plan": [
+ { "name": "gcc is present", "depends on": [ null ] },
+ { "name": "gcYou are not c can compile", "depends on": [ "gcc is present" ] }
+ ]
+}
\ No newline at end of file
diff --git a/cmake-build-debug/conf/units/all_test.units b/cmake-build-debug/conf/units/all_test.units
index 9986080..38d2d4b 100644
--- a/cmake-build-debug/conf/units/all_test.units
+++ b/cmake-build-debug/conf/units/all_test.units
@@ -1,19 +1,22 @@
{
- "name": "gcc is present",
- "target": "./ubuntu/xenial/check_gcc_present.run",
- "output": "present",
- "rectifier": "./ubuntu/xenial/install_gcc",
- "active": true,
- "required": true,
- "rectify": true
-},
-{
- "name": "gcc can compile",
- "target": "./ubuntu/xenial/check_gcc_compiles.run",
- "output": "can compile",
- "rectifier": "",
- "active": true,
- "required": true,
- "rectify": false
-}
-
+ "units": [
+ {
+ "name": "gcc is present",
+ "target": "./ubuntu/xenial/check_gcc_present.run",
+ "output": "present",
+ "rectifier": "./ubuntu/xenial/install_gcc",
+ "active": true,
+ "required": true,
+ "rectify": true
+ },
+ {
+ "name": "gcc can compile",
+ "target": "./ubuntu/xenial/check_gcc_compiles.run",
+ "output": "can compile",
+ "rectifier": "",
+ "active": true,
+ "required": true,
+ "rectify": false
+ }
+ ]
+}
\ No newline at end of file
diff --git a/cmake-build-debug/config.json b/cmake-build-debug/config.json
index cf7693b..d1248a0 100644
--- a/cmake-build-debug/config.json
+++ b/cmake-build-debug/config.json
@@ -1,7 +1,4 @@
{
- "units_path": "./conf/units",
- "plan_path": "./conf/test.plan",
- "arr_test": [
- "rt", "te", "ter", "ter"
- ]
+ "units_path": "./conf/units/all_test.units",
+ "plan_path": "./conf/test.plan"
}
diff --git a/cmake-build-debug/ftests b/cmake-build-debug/ftests
index 2c51d37..cbec02b 100755
Binary files a/cmake-build-debug/ftests and b/cmake-build-debug/ftests differ
diff --git a/cmake-build-debug/ftests.cbp b/cmake-build-debug/ftests.cbp
index 1378bd2..d84f8fa 100644
--- a/cmake-build-debug/ftests.cbp
+++ b/cmake-build-debug/ftests.cbp
@@ -84,20 +84,20 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
diff --git a/main.cpp b/main.cpp
index 90da2c5..12b09bf 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,21 +1,11 @@
#include
-#include
#include "src/json/json.h"
-#include
-#include "src/json/json-forwards.h"
#include "src/loaders.h"
-/*configuration load_config_file( std::string filename )
-{
- json j_conf = json_file_to_json_obj( filename );
- configuration appconfig = j_conf;
- return appconfig;
-}*/
-
int main()
{
Conf jsonLoader = Conf("config.json");
+ UnitHolder units = UnitHolder( jsonLoader.get_units_path() );
- std::cout << jsonLoader.get_units_path();
return 0;
}
\ No newline at end of file
diff --git a/src/loaders.cpp b/src/loaders.cpp
index 57a3ecd..932018f 100644
--- a/src/loaders.cpp
+++ b/src/loaders.cpp
@@ -1,15 +1,6 @@
-//
-// Created by phanes on 4/16/17.
-//
-
#include "loaders.h"
-#include "json/json.h"
-#include "json/json-forwards.h"
-#include
-#include
#include
-
inline bool exists(const std::string& name)
{
struct stat buffer;
@@ -33,7 +24,7 @@ JLoader::JLoader( std::string filename )
if (! parsingSuccessful )
{
std::cerr << "Failed to parse " << filename << ":\n\t" << reader.getFormattedErrorMessages();
- exit(1);
+ exit( 1 );
} else {
std::cout << "Parsed " << filename << " with " << this->json_root.size() << " elements." << std::endl;
}
@@ -44,15 +35,40 @@ Json::Value JLoader::get_root()
return this->json_root;
}
-
-Unit::Unit( std::string filename ): JLoader( filename )
+Unit::Unit( Json::Value loader_root )
{
+ this->name = loader_root.get("name", "?").asString();
+ this->target = loader_root.get("target", "?").asString();
+ this->output = loader_root.get("output", "?").asString();
+ this->rectifier = loader_root.get("rectifier", "?").asString();
+ this->active = loader_root.get("active", "?").asString();
+ 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; }
+std::string Unit::get_rectifier() { return this->rectifier; }
+std::string Unit::get_active() { return this->active; }
+std::string Unit::get_required() { return this->required; }
+std::string Unit::get_rectify() { return this->rectify; }
+UnitHolder::UnitHolder( std::string filename ): JLoader( filename )
+{
+/* UnitHolder loads a file and deserializes the Unit JSON object to Unit types as a vector member
+ * UnitHolder { vector }
+ */
+ Json::Value raw_units = this->get_root()["units"];
+
+ for ( int index = 0; index < raw_units.size(); index++ )
+ {
+ this->Units.push_back(Unit( raw_units[index] ));
+ }
};
Plan::Plan( std::string filename ): JLoader( filename )
{
-
+ // TODO: Implement
};
Conf::Conf( std::string filename ): JLoader( filename )
diff --git a/src/loaders.h b/src/loaders.h
index 604e214..ef5ed3c 100644
--- a/src/loaders.h
+++ b/src/loaders.h
@@ -22,29 +22,48 @@ class JLoader
Json::Value get_root();
};
-class Unit: public JLoader
+class Unit
{
private:
- Json::Value json_root;
+ std::string name;
+ std::string target;
+ std::string output;
+ std::string rectifier;
+ std::string active;
+ std::string required;
+ std::string rectify;
+
+ public:
+ Unit( Json::Value loader_root );
+ std::string get_name();
+ std::string get_target();
+ std::string get_output();
+ std::string get_rectifier();
+ std::string get_active();
+ std::string get_required();
+ std::string get_rectify();
+};
+
+class UnitHolder: public JLoader
+{
+ private:
+ std::vector Units;
+
public:
using JLoader::JLoader;
- Unit( std::string filename );
+ UnitHolder( std::string filename );
};
class Plan: public JLoader
{
- private:
- Json::Value json_root;
public:
using JLoader::JLoader;
Plan( std::string filename );
};
-
class Conf: public JLoader
{
private:
- Json::Value json_root;
std::string plan_path;
std::string units_path;
@@ -55,5 +74,4 @@ class Conf: public JLoader
std::string get_units_path();
};
-
#endif //FTESTS_LOADERS_H