Create class ReportExcelCompared
This commit is contained in:
@@ -49,5 +49,8 @@ target_link_libraries(b_main PyClassifiers BayesNet ArffFiles mdlp)
|
||||
# b_manage
|
||||
set(manage_sources b_manage.cc ManageResults.cc CommandParser.cc Results.cc)
|
||||
list(TRANSFORM manage_sources PREPEND manage/)
|
||||
add_executable(b_manage ${manage_sources} main/Result.cc reports/ReportConsole.cc reports/ReportExcel.cc reports/ReportBase.cc reports/ExcelFile.cc common/Datasets.cc common/Dataset.cc)
|
||||
add_executable(b_manage ${manage_sources} main/Result.cc
|
||||
reports/ReportConsole.cc reports/ReportExcel.cc reports/ReportExcelCompared.cc reports/ReportBase.cc reports/ExcelFile.cc
|
||||
common/Datasets.cc common/Dataset.cc
|
||||
)
|
||||
target_link_libraries(b_manage "${TORCH_LIBRARIES}" "${XLSXWRITER_LIB}" ArffFiles mdlp)
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "Paths.h"
|
||||
#include "ReportConsole.h"
|
||||
#include "ReportExcel.h"
|
||||
#include "ReportExcelCompared.h"
|
||||
|
||||
namespace platform {
|
||||
|
||||
@@ -84,6 +85,14 @@ namespace platform {
|
||||
std::cout << "Not done!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
void ManageResults::report_compared(const int index_A, const int index_B)
|
||||
{
|
||||
std::cout << "Comparing " << results.at(index_A).getFilename() << " with " << results.at(index_B).getFilename() << std::endl;
|
||||
auto data_A = results.at(index_A).getJson();
|
||||
auto data_B = results.at(index_B).getJson();
|
||||
ReportExcelCompared reporter(data_A, data_B);
|
||||
reporter.report();
|
||||
}
|
||||
void ManageResults::report(const int index, const bool excelReport)
|
||||
{
|
||||
std::cout << Colors::YELLOW() << "Reporting " << results.at(index).getFilename() << std::endl;
|
||||
@@ -140,7 +149,7 @@ namespace platform {
|
||||
void ManageResults::menu()
|
||||
{
|
||||
char option;
|
||||
int index, subIndex;
|
||||
int index, subIndex, index_A = -1, index_B = -1;
|
||||
bool finished = false;
|
||||
std::string filename;
|
||||
// tuple<Option, digit, requires value>
|
||||
@@ -152,7 +161,10 @@ namespace platform {
|
||||
{"sort", 's', false},
|
||||
{"report", 'r', true},
|
||||
{"excel", 'e', true},
|
||||
{"title", 't', true}
|
||||
{"title", 't', true},
|
||||
{"set A", 'a', true},
|
||||
{"set B", 'b', true},
|
||||
{"compare A~B", 'c', false}
|
||||
};
|
||||
// tuple<Option, digit, requires value>
|
||||
std::vector<std::tuple<std::string, char, bool>> listOptions = {
|
||||
@@ -172,9 +184,31 @@ namespace platform {
|
||||
case 'q':
|
||||
finished = true;
|
||||
break;
|
||||
case 'a':
|
||||
if (index == index_B) {
|
||||
std::cout << Colors::RED() << "A and B cannot be the same!" << Colors::RESET() << std::endl;
|
||||
break;
|
||||
}
|
||||
index_A = index;
|
||||
break;
|
||||
case 'b':
|
||||
// back to show the report
|
||||
report(index, false);
|
||||
if (indexList) {
|
||||
if (index == index_A) {
|
||||
std::cout << Colors::RED() << "A and B cannot be the same!" << Colors::RESET() << std::endl;
|
||||
break;
|
||||
}
|
||||
index_B = index;
|
||||
} else {
|
||||
// back to show the report
|
||||
report(index, false);
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
if (index_A == -1 || index_B == -1) {
|
||||
std::cout << Colors::RED() << "Need to set A and B first!" << Colors::RESET() << std::endl;
|
||||
break;
|
||||
}
|
||||
report_compared(index_A, index_B);
|
||||
break;
|
||||
case 'l':
|
||||
list();
|
||||
|
@@ -13,6 +13,7 @@ namespace platform {
|
||||
void list();
|
||||
bool confirmAction(const std::string& intent, const std::string& fileName) const;
|
||||
void report(const int index, const bool excelReport);
|
||||
void report_compared(const int index_A, const int index_B);
|
||||
void showIndex(const int index, const int idx);
|
||||
void sortList();
|
||||
void menu();
|
||||
@@ -25,7 +26,6 @@ namespace platform {
|
||||
Results results;
|
||||
lxw_workbook* workbook;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* MANAGE_RESULTS_H */
|
@@ -9,11 +9,11 @@ namespace platform {
|
||||
class ReportExcel : public ReportBase, public ExcelFile {
|
||||
public:
|
||||
explicit ReportExcel(json data_, bool compare, lxw_workbook* workbook, lxw_worksheet* worksheet = NULL);
|
||||
void closeFile();
|
||||
private:
|
||||
void formatColumns();
|
||||
void createFile();
|
||||
void createWorksheet();
|
||||
void closeFile();
|
||||
void header() override;
|
||||
void body() override;
|
||||
void showSummary() override;
|
||||
|
21
src/reports/ReportExcelCompared.cc
Normal file
21
src/reports/ReportExcelCompared.cc
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "ReportExcelCompared.h"
|
||||
|
||||
namespace platform {
|
||||
|
||||
ReportExcelCompared::ReportExcelCompared(json& data_A, json& data_B) : data_A(data_A), data_B(data_B), workbook(NULL)
|
||||
{
|
||||
ReportExcel report(data_A, false, workbook);
|
||||
workbook = report.getWorkbook();
|
||||
report.show();
|
||||
report = ReportExcel(data_B, false, workbook);
|
||||
report.show();
|
||||
}
|
||||
ReportExcelCompared::~ReportExcelCompared()
|
||||
{
|
||||
workbook_close(workbook);
|
||||
}
|
||||
void ReportExcelCompared::report()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
14
src/reports/ReportExcelCompared.h
Normal file
14
src/reports/ReportExcelCompared.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "ReportExcel.h"
|
||||
namespace platform {
|
||||
class ReportExcelCompared {
|
||||
public:
|
||||
explicit ReportExcelCompared(json& data_A, json& data_B);
|
||||
~ReportExcelCompared();
|
||||
void report();
|
||||
private:
|
||||
json& data_A;
|
||||
json& data_B;
|
||||
lxw_workbook* workbook;
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user