Commit ff75a83c authored by Mario Bajer's avatar Mario Bajer
Browse files

cleaned list

changed multi to require target .json file
parent 26c8b8c0
......@@ -5,19 +5,19 @@ int main(){
htmlHeader("list.cgi");
cout << "<body>" << endl;
cout << "<br>" << endl;
cout << "<div class=\"container\">" << endl;
cout << "<table class=\"table\">" << endl;
cout << "<thead class=\"thead-dark\">" << endl;
cout << "<tr>" << endl;
cout << "<th>ID</th>" << endl;
cout << "<th>Dimension</th>" << endl;
cout << "<th>File Location</th>" << endl;
cout << "<th></th>" << endl;
cout << "</tr>" << endl;
cout << "</thead>" << endl;
cout << "<tbody>" << endl;
cout << "<body>"
"<br>"
"<div class=\"container\">"
"<table class=\"table\">"
"<thead class=\"thead-dark\">"
"<tr>"
"<th>ID</th>"
"<th>Dimension</th>"
"<th>File Location</th>"
"<th></th>"
"</tr>"
"</thead>"
"<tbody>" << endl;
string path = "Json";
for(const auto & entry : fs::directory_iterator(path)){
......
......@@ -85,6 +85,7 @@ int main(){
string matrixs1 = "";
string matrixs2 = "";
string matrixs3 = "";
form_iterator fi1 = formData.getElement("multi1");
if( !fi1->isEmpty() && fi1 != (*formData).end()) {
matrixs1 = **fi1;
......@@ -103,13 +104,24 @@ int main(){
cout << "Error on Matrix 2!" << endl;
}
form_iterator fi3 = formData.getElement("multi3");
if( !fi3->isEmpty() && fi3 != (*formData).end()) {
matrixs3 = **fi3;
cout << matrixs3 << endl;
}
else {
cout << "Error on Matrix 3 (result)!" << endl;
}
string debug = "debug 0";
cout << debug << endl;
json json1;
json json2;
json json3;
ifstream in1(matrixs1);
ifstream in2(matrixs2);
// ifstream in3(matrixs3);
in1 >> json1;
in2 >> json2;
cout << "debug 1" << endl;
......@@ -138,28 +150,34 @@ int main(){
result = run(mult_strassen, matrix1, matrix2);
cout << "debug 4";
json json3;
srand(time(NULL));
result.ID = rand() % 100;
string folderpath = "Json/";
string testpath = folderpath + to_string(result.ID);
while(existsm(testpath)){
cout << "<p>" << "File mit ID: " << result.ID << " existiert bereits!" << "</p>";
result.ID = rand() % 100;
testpath = folderpath + to_string(result.ID);
}
folderpath += to_string(result.ID) + ".json";
json3["id"] = result.ID;
json3["dimension"] = result.dim;
// json3["id"] = result.ID;
// json3["dimension"] = result.dim;
int size = result.dim * result.dim;
vector<int> v(result.data, result.data + size);
json3["matrix"] = v;
ofstream o;
o.open(folderpath);
o << json3 << endl;
o.close();
// json json3;
// srand(time(NULL));
//
// result.ID = rand() % 100;
// string folderpath = "Json/";
// string testpath = folderpath + to_string(result.ID);
// while(existsm(testpath)){
// cout << "<p>" << "File mit ID: " << result.ID << " existiert bereits!" << "</p>";
// result.ID = rand() % 100;
// testpath = folderpath + to_string(result.ID);
// }
// folderpath += to_string(result.ID) + ".json";
// json3["id"] = result.ID;
// json3["dimension"] = result.dim;
// int size = result.dim * result.dim;
// vector<int> v(result.data, result.data + size);
// json3["matrix"] = v;
// ofstream o;
// o.open(folderpath);
// o << json3 << endl;
// o.close();
// result.generateMatrix(result.dim);
cout << "Resulting Matrix saved at ID: " + to_string(result.ID) << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment