From 25bd7a42c6653e622e96484a54c70e7b5b166b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Sat, 18 May 2024 13:00:13 +0200 Subject: [PATCH] Replacce pragma once with ifndef --- config/config.h.in | 5 +++-- src/best/BestResults.h | 5 +++-- src/best/BestResultsExcel.h | 5 +++-- src/best/BestScore.h | 5 +++-- src/best/Statistics.h | 5 +++-- src/common/CLocale.h | 5 +++-- src/common/Colors.h | 5 +++-- src/common/Dataset.h | 6 +++--- src/common/Datasets.h | 5 +++-- src/common/DotEnv.h | 5 +++-- src/common/Paths.h | 5 +++-- src/common/Symbols.h | 5 +++-- src/common/Timer.h | 5 +++-- src/common/Utils.h | 6 +++--- src/grid/GridData.h | 5 +++-- src/grid/GridSearch.h | 5 +++-- src/main/Experiment.h | 7 ++++--- src/main/HyperParameters.h | 5 +++-- src/main/Models.h | 5 +++-- src/main/PartialResult.h | 5 +++-- src/main/Scores.h | 2 ++ src/main/modelRegister.h | 7 +++++-- src/manage/CommandParser.h | 5 +++-- src/manage/ManageScreen.cpp | 2 +- src/manage/ManageScreen.h | 5 +++-- src/manage/Paginator.hpp | 7 ++++--- src/manage/ResultsManager.h | 7 ++++--- src/reports/DatasetsConsole.h | 6 +++--- src/reports/DatasetsExcel.cpp | 1 - src/reports/DatasetsExcel.h | 5 +++-- src/reports/ExcelFile.h | 5 +++-- src/reports/ReportBase.h | 1 - src/reports/ReportConsole.h | 5 +++-- src/reports/ReportExcel.cpp | 2 -- src/reports/ReportExcelCompared.h | 6 ++++-- src/reports/ReportsPaged.h | 5 +++-- src/reports/ResultsDatasetConsole.h | 9 +++------ src/results/Result.h | 5 +++-- src/results/ResultsDataset.h | 7 ++++--- src/results/ResultsDatasetExcel.h | 5 +++-- tests/TestUtils.h | 6 +++--- 41 files changed, 118 insertions(+), 89 deletions(-) diff --git a/config/config.h.in b/config/config.h.in index 73db51c..a25b205 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -1,5 +1,5 @@ -#pragma once - +#ifndef PLATFORM_H +#define PLATFORM_H #include #include @@ -8,3 +8,4 @@ static constexpr std::string_view platform_project_version = "@PROJECT_VERSION@" static constexpr std::string_view platform_project_description = "@PROJECT_DESCRIPTION@"; static constexpr std::string_view platform_git_sha = "@GIT_SHA@"; static constexpr std::string_view platform_data_path = "@Platform_SOURCE_DIR@/tests/data/"; +#endif \ No newline at end of file diff --git a/src/best/BestResults.h b/src/best/BestResults.h index 375b936..2815e97 100644 --- a/src/best/BestResults.h +++ b/src/best/BestResults.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef BESTRESULTS_H +#define BESTRESULTS_H #include #include namespace platform { @@ -35,3 +35,4 @@ namespace platform { int maxDatasetName = 0; }; } +#endif \ No newline at end of file diff --git a/src/best/BestResultsExcel.h b/src/best/BestResultsExcel.h index 430ff7e..6c70a49 100644 --- a/src/best/BestResultsExcel.h +++ b/src/best/BestResultsExcel.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef BESTRESULTSEXCEL_H +#define BESTRESULTSEXCEL_H #include #include #include @@ -33,3 +33,4 @@ namespace platform { int datasetNameSize = 25; // Min size of the column }; } +#endif \ No newline at end of file diff --git a/src/best/BestScore.h b/src/best/BestScore.h index 6d90c38..ab69946 100644 --- a/src/best/BestScore.h +++ b/src/best/BestScore.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef BESTSCORE_H +#define BESTSCORE_H #include #include #include @@ -24,3 +24,4 @@ namespace platform { } }; } +#endif \ No newline at end of file diff --git a/src/best/Statistics.h b/src/best/Statistics.h index 1ac7364..f082056 100644 --- a/src/best/Statistics.h +++ b/src/best/Statistics.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef STATISTICS_H +#define STATISTICS_H #include #include #include @@ -60,3 +60,4 @@ namespace platform { std::map> ranksModels; }; } +#endif \ No newline at end of file diff --git a/src/common/CLocale.h b/src/common/CLocale.h index 57c6efc..8457209 100644 --- a/src/common/CLocale.h +++ b/src/common/CLocale.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef CLOCALE_H +#define CLOCALE_H #include #include #include @@ -19,3 +19,4 @@ namespace platform { } }; } +#endif \ No newline at end of file diff --git a/src/common/Colors.h b/src/common/Colors.h index 95cc494..a80c192 100644 --- a/src/common/Colors.h +++ b/src/common/Colors.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef COLORS_H +#define COLORS_H #include class Colors { public: @@ -27,3 +27,4 @@ public: static std::string CONCEALED() { return "\033[8m"; } static std::string CLRSCR() { return "\033[2J\033[1;1H"; } }; +#endif \ No newline at end of file diff --git a/src/common/Dataset.h b/src/common/Dataset.h index b88db75..3e1180e 100644 --- a/src/common/Dataset.h +++ b/src/common/Dataset.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef DATASET_H +#define DATASET_H #include #include #include @@ -48,4 +48,4 @@ namespace platform { std::vector discretizeDataset(std::vector& X, mdlp::labels_t& y); }; }; - +#endif diff --git a/src/common/Datasets.h b/src/common/Datasets.h index 07c99d6..028a9f1 100644 --- a/src/common/Datasets.h +++ b/src/common/Datasets.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef DATASETS_H +#define DATASETS_H #include "Dataset.h" namespace platform { class Datasets { @@ -28,3 +28,4 @@ namespace platform { void load(); // Loads the list of datasets }; }; +#endif \ No newline at end of file diff --git a/src/common/DotEnv.h b/src/common/DotEnv.h index 6882f09..07cc921 100644 --- a/src/common/DotEnv.h +++ b/src/common/DotEnv.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef DOTENV_H +#define DOTENV_H #include #include #include @@ -59,3 +59,4 @@ namespace platform { } }; } +#endif \ No newline at end of file diff --git a/src/common/Paths.h b/src/common/Paths.h index 0b7ef32..6fd61cf 100644 --- a/src/common/Paths.h +++ b/src/common/Paths.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef PATHS_H +#define PATHS_H #include #include #include "DotEnv.h" @@ -36,3 +36,4 @@ namespace platform { } }; } +#endif \ No newline at end of file diff --git a/src/common/Symbols.h b/src/common/Symbols.h index 0db13b3..75af4bc 100644 --- a/src/common/Symbols.h +++ b/src/common/Symbols.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef SYMBOLS_H +#define SYMBOLS_H #include namespace platform { class Symbols { @@ -17,3 +17,4 @@ namespace platform { inline static const std::string notebook{ "\U0001F5C8" }; }; } +#endif \ No newline at end of file diff --git a/src/common/Timer.h b/src/common/Timer.h index c12aa70..dd2e820 100644 --- a/src/common/Timer.h +++ b/src/common/Timer.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef TIMER_H +#define TIMER_H #include #include #include @@ -40,3 +40,4 @@ namespace platform { } }; } /* namespace platform */ +#endif \ No newline at end of file diff --git a/src/common/Utils.h b/src/common/Utils.h index 3149fcc..e13629c 100644 --- a/src/common/Utils.h +++ b/src/common/Utils.h @@ -1,10 +1,9 @@ -#pragma once - +#ifndef UTILS_H +#define UTILS_H #include #include #include namespace platform { - //static std::vector split(const std::string& text, char delimiter); static std::vector split(const std::string& text, char delimiter) { std::vector result; @@ -27,3 +26,4 @@ namespace platform { return result; } } +#endif \ No newline at end of file diff --git a/src/grid/GridData.h b/src/grid/GridData.h index 98abd14..9efa9a5 100644 --- a/src/grid/GridData.h +++ b/src/grid/GridData.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef GRIDDATA_H +#define GRIDDATA_H #include #include #include @@ -23,3 +23,4 @@ namespace platform { std::map grid; }; } /* namespace platform */ +#endif \ No newline at end of file diff --git a/src/grid/GridSearch.h b/src/grid/GridSearch.h index 08226be..4ca7571 100644 --- a/src/grid/GridSearch.h +++ b/src/grid/GridSearch.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef GRIDSEARCH_H +#define GRIDSEARCH_H #include #include #include @@ -57,3 +57,4 @@ namespace platform { Timer timer; // used to measure the time of the whole process }; } /* namespace platform */ +#endif \ No newline at end of file diff --git a/src/main/Experiment.h b/src/main/Experiment.h index b5868ef..4cbd5a4 100644 --- a/src/main/Experiment.h +++ b/src/main/Experiment.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef EXPERIMENT_H +#define EXPERIMENT_H #include #include #include @@ -42,4 +42,5 @@ namespace platform { int nfolds{ 0 }; int max_name{ 7 }; // max length of dataset name for formatting (default 7) }; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/main/HyperParameters.h b/src/main/HyperParameters.h index 1ef3a3a..2a1aec0 100644 --- a/src/main/HyperParameters.h +++ b/src/main/HyperParameters.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef HYPERPARAMETERS_H +#define HYPERPARAMETERS_H #include #include #include @@ -20,3 +20,4 @@ namespace platform { std::map hyperparameters; }; } /* namespace platform */ +#endif \ No newline at end of file diff --git a/src/main/Models.h b/src/main/Models.h index cd9844f..e8eb58f 100644 --- a/src/main/Models.h +++ b/src/main/Models.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef MODELS_H +#define MODELS_H #include #include #include @@ -42,3 +42,4 @@ namespace platform { Registrar(const std::string& className, function classFactoryFunction); }; } +#endif \ No newline at end of file diff --git a/src/main/PartialResult.h b/src/main/PartialResult.h index c141046..03dea41 100644 --- a/src/main/PartialResult.h +++ b/src/main/PartialResult.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef PARTIAL_RESULT_H +#define PARTIAL_RESULT_H #include #include @@ -73,3 +73,4 @@ namespace platform { json data; }; } +#endif \ No newline at end of file diff --git a/src/main/Scores.h b/src/main/Scores.h index 76c4ee4..2de7e2a 100644 --- a/src/main/Scores.h +++ b/src/main/Scores.h @@ -4,6 +4,8 @@ #include #include #include +#include + namespace platform { using json = nlohmann::ordered_json; class Scores { diff --git a/src/main/modelRegister.h b/src/main/modelRegister.h index 26d8e23..4578ef2 100644 --- a/src/main/modelRegister.h +++ b/src/main/modelRegister.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef MODELREGISTER_H +#define MODELREGISTER_H static platform::Registrar registrarT("TAN", [](void) -> bayesnet::BaseClassifier* { return new bayesnet::TAN();}); @@ -33,4 +34,6 @@ static platform::Registrar registrarSvc("SVC", static platform::Registrar registrarRaF("RandomForest", [](void) -> bayesnet::BaseClassifier* { return new pywrap::RandomForest();}); static platform::Registrar registrarXGB("XGBoost", - [](void) -> bayesnet::BaseClassifier* { return new pywrap::XGBoost();}); \ No newline at end of file + [](void) -> bayesnet::BaseClassifier* { return new pywrap::XGBoost();}); + +#endif \ No newline at end of file diff --git a/src/manage/CommandParser.h b/src/manage/CommandParser.h index ac6f21d..e080ecd 100644 --- a/src/manage/CommandParser.h +++ b/src/manage/CommandParser.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef COMMAND_PARSER_H +#define COMMAND_PARSER_H #include #include #include @@ -18,3 +18,4 @@ namespace platform { int index; }; } /* namespace platform */ +#endif \ No newline at end of file diff --git a/src/manage/ManageScreen.cpp b/src/manage/ManageScreen.cpp index 1220b44..e0632be 100644 --- a/src/manage/ManageScreen.cpp +++ b/src/manage/ManageScreen.cpp @@ -254,7 +254,7 @@ namespace platform { while (!finished) { std::cout << color << "Really want to " << intent << " " << fileName << "? (y/n): "; getline(std::cin, line); - finished = line.size() == 1 && (tolower(line[0]) == 'y' || tolower(line[0] == 'n')); + finished = line.size() == 1 && (tolower(line[0]) == 'y' || tolower(line[0]) == 'n'); } if (tolower(line[0]) == 'y') { return true; diff --git a/src/manage/ManageScreen.h b/src/manage/ManageScreen.h index 7dc645a..b53dc90 100644 --- a/src/manage/ManageScreen.h +++ b/src/manage/ManageScreen.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef MANAGE_SCREEN_H +#define MANAGE_SCREEN_H #include #include "ResultsManager.h" #include "Paginator.hpp" @@ -50,3 +50,4 @@ namespace platform { lxw_workbook* workbook; }; } +#endif \ No newline at end of file diff --git a/src/manage/Paginator.hpp b/src/manage/Paginator.hpp index 53d21ca..cd2f2bb 100644 --- a/src/manage/Paginator.hpp +++ b/src/manage/Paginator.hpp @@ -1,5 +1,5 @@ -#pragma once - +#ifndef PAGINATOR_HPP +#define PAGINATOR_HPP #include class Paginator { @@ -53,4 +53,5 @@ private: int total; int page; int numPages; -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/manage/ResultsManager.h b/src/manage/ResultsManager.h index 9793959..cabf909 100644 --- a/src/manage/ResultsManager.h +++ b/src/manage/ResultsManager.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef RESULTSMANAGER_H +#define RESULTSMANAGER_H #include #include #include @@ -45,4 +45,5 @@ namespace platform { int maxTitle; std::vector files; }; -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/reports/DatasetsConsole.h b/src/reports/DatasetsConsole.h index 4c1e972..f874536 100644 --- a/src/reports/DatasetsConsole.h +++ b/src/reports/DatasetsConsole.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef DATASETSCONSOLE_H +#define DATASETSCONSOLE_H #include #include #include @@ -18,4 +18,4 @@ namespace platform { void split_lines(int name_len, std::string line, const std::string& balance); }; } - +#endif diff --git a/src/reports/DatasetsExcel.cpp b/src/reports/DatasetsExcel.cpp index d82d8a7..267f103 100644 --- a/src/reports/DatasetsExcel.cpp +++ b/src/reports/DatasetsExcel.cpp @@ -1,5 +1,4 @@ #include "DatasetsExcel.h" - namespace platform { DatasetsExcel::DatasetsExcel() { diff --git a/src/reports/DatasetsExcel.h b/src/reports/DatasetsExcel.h index 32b19e8..cd543cd 100644 --- a/src/reports/DatasetsExcel.h +++ b/src/reports/DatasetsExcel.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef DATASETSEXCEL_H +#define DATASETSEXCEL_H #include #include "reports/ExcelFile.h" @@ -13,3 +13,4 @@ namespace platform { void report(json& data); }; } +#endif \ No newline at end of file diff --git a/src/reports/ExcelFile.h b/src/reports/ExcelFile.h index eddbc7f..d7a77fc 100644 --- a/src/reports/ExcelFile.h +++ b/src/reports/ExcelFile.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef EXCELFILE_H +#define EXCELFILE_H #include #include #include @@ -39,3 +39,4 @@ namespace platform { void setDefault(); }; } +#endif \ No newline at end of file diff --git a/src/reports/ReportBase.h b/src/reports/ReportBase.h index d6d227a..bc689fd 100644 --- a/src/reports/ReportBase.h +++ b/src/reports/ReportBase.h @@ -1,7 +1,6 @@ #ifndef REPORTBASE_H #define REPORTBASE_H -//#include "main/Scores.h" #include #include #include "common/Paths.h" diff --git a/src/reports/ReportConsole.h b/src/reports/ReportConsole.h index 73bcaec..2ee6b32 100644 --- a/src/reports/ReportConsole.h +++ b/src/reports/ReportConsole.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef REPORT_CONSOLE_H +#define REPORT_CONSOLE_H #include #include "common/Colors.h" #include @@ -32,3 +32,4 @@ namespace platform { std::vector vbody; }; }; +#endif \ No newline at end of file diff --git a/src/reports/ReportExcel.cpp b/src/reports/ReportExcel.cpp index 7df7a5b..1b2fed2 100644 --- a/src/reports/ReportExcel.cpp +++ b/src/reports/ReportExcel.cpp @@ -2,8 +2,6 @@ #include #include "best/BestScore.h" #include "ReportExcel.h" - - namespace platform { ReportExcel::ReportExcel(json data_, bool compare, lxw_workbook* workbook, lxw_worksheet* worksheet) : ReportBase(data_, compare), ExcelFile(workbook, worksheet) diff --git a/src/reports/ReportExcelCompared.h b/src/reports/ReportExcelCompared.h index c6d3793..174b9a9 100644 --- a/src/reports/ReportExcelCompared.h +++ b/src/reports/ReportExcelCompared.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef REPORT_EXCEL_COMPARED_H +#define REPORT_EXCEL_COMPARED_H #include "ReportExcel.h" namespace platform { class ReportExcelCompared : public ExcelFile { @@ -16,4 +17,5 @@ namespace platform { std::string leaves_label; std::string depth_label; }; -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/reports/ReportsPaged.h b/src/reports/ReportsPaged.h index 3e81923..6650dbd 100644 --- a/src/reports/ReportsPaged.h +++ b/src/reports/ReportsPaged.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef REPORTS_PAGED_H +#define REPORTS_PAGED_H #include #include #include @@ -23,3 +23,4 @@ namespace platform { std::locale loc; }; } +#endif \ No newline at end of file diff --git a/src/reports/ResultsDatasetConsole.h b/src/reports/ResultsDatasetConsole.h index cc3fe4b..787edec 100644 --- a/src/reports/ResultsDatasetConsole.h +++ b/src/reports/ResultsDatasetConsole.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef RESULTSDATASETSCONSOLE_H +#define RESULTSDATASETSCONSOLE_H #include #include #include @@ -15,7 +15,4 @@ namespace platform { bool report(const std::string& dataset, const std::string& score, const std::string& model); }; } - - - - +#endif \ No newline at end of file diff --git a/src/results/Result.h b/src/results/Result.h index cafeb69..e7025b2 100644 --- a/src/results/Result.h +++ b/src/results/Result.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef RESULT_H +#define RESULT_H #include #include #include @@ -51,3 +51,4 @@ namespace platform { double score = 0.0; }; }; +#endif \ No newline at end of file diff --git a/src/results/ResultsDataset.h b/src/results/ResultsDataset.h index a9d1935..32769d9 100644 --- a/src/results/ResultsDataset.h +++ b/src/results/ResultsDataset.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef RESULTSDATASET_H +#define RESULTSDATASET_H #include #include #include @@ -31,4 +31,5 @@ namespace platform { double maxResult; std::vector files; }; -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/results/ResultsDatasetExcel.h b/src/results/ResultsDatasetExcel.h index dfbc618..83226cc 100644 --- a/src/results/ResultsDatasetExcel.h +++ b/src/results/ResultsDatasetExcel.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef RESULTSDATASETEXCEL_H +#define RESULTSDATASETEXCEL_H #include #include "reports/ExcelFile.h" @@ -14,3 +14,4 @@ namespace platform { void report(json& data); }; } +#endif \ No newline at end of file diff --git a/tests/TestUtils.h b/tests/TestUtils.h index 39530ec..d0cf4d9 100644 --- a/tests/TestUtils.h +++ b/tests/TestUtils.h @@ -1,5 +1,5 @@ -#pragma once - +#ifndef TESTUTILS_H +#define TESTUTILS_H #include #include #include @@ -39,4 +39,4 @@ public: int nSamples, classNumStates; double epsilon = 1e-5; }; - +#endif \ No newline at end of file