Rename ManageResults -> ManageScreen

This commit is contained in:
2024-03-16 23:44:21 +01:00
parent 67487ffce1
commit 37eba57765
4 changed files with 25 additions and 25 deletions

View File

@@ -56,7 +56,7 @@ add_executable(b_main commands/b_main.cpp ${main_sources}
target_link_libraries(b_main "${PyClassifiers}" "${BayesNet}" ArffFiles mdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" ${LIBTORCH_PYTHON} Boost::python Boost::numpy)
# b_manage
set(manage_sources ManageResults.cpp CommandParser.cpp ResultsManager.cpp)
set(manage_sources ManageScreen.cpp CommandParser.cpp ResultsManager.cpp)
list(TRANSFORM manage_sources PREPEND manage/)
add_executable(
b_manage commands/b_manage.cpp ${manage_sources}

View File

@@ -2,7 +2,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <argparse/argparse.hpp>
#include "manage/ManageResults.h"
#include "manage/ManageScreen.h"
#include "config.h"
void manageArguments(argparse::ArgumentParser& program, int argc, char** argv)
@@ -62,7 +62,7 @@ int main(int argc, char** argv)
}
if (complete)
partial = false;
auto manager = platform::ManageResults(number, model, score, complete, partial, compare);
auto manager = platform::ManageScreen(number, model, score, complete, partial, compare);
manager.doMenu();
return 0;
}

View File

@@ -5,7 +5,7 @@
#include "common/CLocale.h"
#include "common/Paths.h"
#include "CommandParser.h"
#include "ManageResults.h"
#include "ManageScreen.h"
#include "reports/DatasetsConsole.h"
#include "reports/ReportConsole.h"
#include "reports/ReportExcel.h"
@@ -15,7 +15,7 @@
namespace platform {
const std::string STATUS_OK = "Ok.";
const std::string STATUS_COLOR = Colors::GREEN();
ManageResults::ManageResults(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare) :
ManageScreen::ManageScreen(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare) :
numFiles{ numFiles }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(model, score, complete, partial))
{
results.load();
@@ -36,7 +36,7 @@ namespace platform {
max_status_line = 140;
output_type = OutputType::EXPERIMENTS;
}
void ManageResults::doMenu()
void ManageScreen::doMenu()
{
if (results.empty()) {
std::cout << Colors::MAGENTA() << "No results found!" << Colors::RESET() << std::endl;
@@ -53,7 +53,7 @@ namespace platform {
}
std::cout << Colors::RESET() << "Done!" << std::endl;
}
void ManageResults::header()
void ManageScreen::header()
{
auto [index_from, index_to] = paginator[static_cast<int>(output_type)].getOffset();
std::string suffix = "";
@@ -75,7 +75,7 @@ namespace platform {
std::cout << Colors::CLRSCR() << Colors::REVERSE() << Colors::WHITE() << header << prefix
<< Colors::MAGENTA() << suffix << Colors::RESET() << std::endl;
}
void ManageResults::footer(const std::string& status, const std::string& status_color)
void ManageScreen::footer(const std::string& status, const std::string& status_color)
{
std::stringstream oss;
oss << " A: " << (index_A == -1 ? "<notset>" : std::to_string(index_A)) <<
@@ -88,21 +88,21 @@ namespace platform {
<< Colors::REVERSE() << status_color << " " << status_line << Colors::IWHITE()
<< Colors::RESET() << std::endl;
}
void ManageResults::list(const std::string& status_message, const std::string& status_color)
void ManageScreen::list(const std::string& status_message, const std::string& status_color)
{
switch (output_type) {
case OutputType::RESULT:
switch (static_cast<int>(output_type)) {
case static_cast<int>(OutputType::RESULT):
list_result(status_message, status_color);
break;
case OutputType::DATASETS:
case static_cast<int>(OutputType::DATASETS):
list_datasets(status_message, status_color);
break;
case OutputType::EXPERIMENTS:
case static_cast<int>(OutputType::EXPERIMENTS):
list_experiments(status_message, status_color);
break;
}
}
void ManageResults::list_result(const std::string& status_message, const std::string& status_color)
void ManageScreen::list_result(const std::string& status_message, const std::string& status_color)
{
//
@@ -115,7 +115,7 @@ namespace platform {
footer(status_message, status_color);
}
void ManageResults::list_datasets(const std::string& status_message, const std::string& status_color)
void ManageScreen::list_datasets(const std::string& status_message, const std::string& status_color)
{
auto report = DatasetsConsole();
report.report();
@@ -139,7 +139,7 @@ namespace platform {
footer(status_message, status_color);
}
void ManageResults::list_experiments(const std::string& status_message, const std::string& status_color)
void ManageScreen::list_experiments(const std::string& status_message, const std::string& status_color)
{
//
// header
@@ -184,7 +184,7 @@ namespace platform {
//
footer(status_message, status_color);
}
bool ManageResults::confirmAction(const std::string& intent, const std::string& fileName) const
bool ManageScreen::confirmAction(const std::string& intent, const std::string& fileName) const
{
std::string color;
if (intent == "delete") {
@@ -205,7 +205,7 @@ namespace platform {
std::cout << "Not done!" << std::endl;
return false;
}
std::string ManageResults::report_compared()
std::string ManageScreen::report_compared()
{
auto data_A = results.at(index_A).getJson();
auto data_B = results.at(index_B).getJson();
@@ -214,7 +214,7 @@ namespace platform {
didExcel = true;
return results.at(index_A).getFilename() + " Vs " + results.at(index_B).getFilename();
}
std::string ManageResults::report(const int index, const bool excelReport)
std::string ManageScreen::report(const int index, const bool excelReport)
{
auto data = results.at(index).getJson();
if (excelReport) {
@@ -230,14 +230,14 @@ namespace platform {
return "Reporting " + results.at(index).getFilename();
}
}
void ManageResults::showIndex(const int index, const int idx)
void ManageScreen::showIndex(const int index, const int idx)
{
// Show a dataset result inside a report
auto data = results.at(index).getJson();
ReportConsole reporter(data, compare, idx);
std::cout << Colors::CLRSCR() << reporter.fileReport();
}
std::pair<std::string, std::string> ManageResults::sortList()
std::pair<std::string, std::string> ManageScreen::sortList()
{
std::cout << Colors::YELLOW() << "Choose sorting field (date='d', score='s', time='t', model='m'): ";
std::string line;
@@ -268,7 +268,7 @@ namespace platform {
return { Colors::RED(), "Invalid sorting option" };
}
}
void ManageResults::menu()
void ManageScreen::menu()
{
char option;
int index, subIndex;

View File

@@ -11,10 +11,10 @@ namespace platform {
RESULT = 2,
Count
};
class ManageResults {
class ManageScreen {
public:
ManageResults(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare);
~ManageResults() = default;
ManageScreen(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare);
~ManageScreen() = default;
void doMenu();
private:
void list(const std::string& status, const std::string& color);