Replacce pragma once with ifndef

This commit is contained in:
2024-05-18 13:00:13 +02:00
parent c165a4bdda
commit 25bd7a42c6
41 changed files with 118 additions and 89 deletions

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef PLATFORM_H
#define PLATFORM_H
#include <string>
#include <string_view>
@@ -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

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef BESTRESULTS_H
#define BESTRESULTS_H
#include <string>
#include <nlohmann/json.hpp>
namespace platform {
@@ -35,3 +35,4 @@ namespace platform {
int maxDatasetName = 0;
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef BESTRESULTSEXCEL_H
#define BESTRESULTSEXCEL_H
#include <vector>
#include <map>
#include <nlohmann/json.hpp>
@@ -33,3 +33,4 @@ namespace platform {
int datasetNameSize = 25; // Min size of the column
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef BESTSCORE_H
#define BESTSCORE_H
#include <string>
#include <map>
#include <utility>
@@ -24,3 +24,4 @@ namespace platform {
}
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef STATISTICS_H
#define STATISTICS_H
#include <iostream>
#include <vector>
#include <map>
@@ -60,3 +60,4 @@ namespace platform {
std::map<std::string, std::map<std::string, float>> ranksModels;
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef CLOCALE_H
#define CLOCALE_H
#include <locale>
#include <iostream>
#include <string>
@@ -19,3 +19,4 @@ namespace platform {
}
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef COLORS_H
#define COLORS_H
#include <string>
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

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef DATASET_H
#define DATASET_H
#include <torch/torch.h>
#include <map>
#include <vector>
@@ -48,4 +48,4 @@ namespace platform {
std::vector<mdlp::labels_t> discretizeDataset(std::vector<mdlp::samples_t>& X, mdlp::labels_t& y);
};
};
#endif

View File

@@ -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

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef DOTENV_H
#define DOTENV_H
#include <string>
#include <map>
#include <fstream>
@@ -59,3 +59,4 @@ namespace platform {
}
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef PATHS_H
#define PATHS_H
#include <string>
#include <filesystem>
#include "DotEnv.h"
@@ -36,3 +36,4 @@ namespace platform {
}
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef SYMBOLS_H
#define SYMBOLS_H
#include <string>
namespace platform {
class Symbols {
@@ -17,3 +17,4 @@ namespace platform {
inline static const std::string notebook{ "\U0001F5C8" };
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef TIMER_H
#define TIMER_H
#include <chrono>
#include <string>
#include <sstream>
@@ -40,3 +40,4 @@ namespace platform {
}
};
} /* namespace platform */
#endif

View File

@@ -1,10 +1,9 @@
#pragma once
#ifndef UTILS_H
#define UTILS_H
#include <sstream>
#include <string>
#include <vector>
namespace platform {
//static std::vector<std::string> split(const std::string& text, char delimiter);
static std::vector<std::string> split(const std::string& text, char delimiter)
{
std::vector<std::string> result;
@@ -27,3 +26,4 @@ namespace platform {
return result;
}
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef GRIDDATA_H
#define GRIDDATA_H
#include <string>
#include <vector>
#include <map>
@@ -23,3 +23,4 @@ namespace platform {
std::map<std::string, json> grid;
};
} /* namespace platform */
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef GRIDSEARCH_H
#define GRIDSEARCH_H
#include <string>
#include <map>
#include <mpi.h>
@@ -57,3 +57,4 @@ namespace platform {
Timer timer; // used to measure the time of the whole process
};
} /* namespace platform */
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef EXPERIMENT_H
#define EXPERIMENT_H
#include <torch/torch.h>
#include <nlohmann/json.hpp>
#include <string>
@@ -42,4 +42,5 @@ namespace platform {
int nfolds{ 0 };
int max_name{ 7 }; // max length of dataset name for formatting (default 7)
};
}
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef HYPERPARAMETERS_H
#define HYPERPARAMETERS_H
#include <string>
#include <map>
#include <vector>
@@ -20,3 +20,4 @@ namespace platform {
std::map<std::string, json> hyperparameters;
};
} /* namespace platform */
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef MODELS_H
#define MODELS_H
#include <map>
#include <bayesnet/BaseClassifier.h>
#include <bayesnet/ensembles/AODE.h>
@@ -42,3 +42,4 @@ namespace platform {
Registrar(const std::string& className, function<bayesnet::BaseClassifier* (void)> classFactoryFunction);
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef PARTIAL_RESULT_H
#define PARTIAL_RESULT_H
#include <string>
#include <nlohmann/json.hpp>
@@ -73,3 +73,4 @@ namespace platform {
json data;
};
}
#endif

View File

@@ -4,6 +4,8 @@
#include <string>
#include <nlohmann/json.hpp>
#include <torch/torch.h>
#include <xlsxwriter.h>
namespace platform {
using json = nlohmann::ordered_json;
class Scores {

View File

@@ -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();});
[](void) -> bayesnet::BaseClassifier* { return new pywrap::XGBoost();});
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef COMMAND_PARSER_H
#define COMMAND_PARSER_H
#include <string>
#include <vector>
#include <tuple>
@@ -18,3 +18,4 @@ namespace platform {
int index;
};
} /* namespace platform */
#endif

View File

@@ -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;

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef MANAGE_SCREEN_H
#define MANAGE_SCREEN_H
#include <xlsxwriter.h>
#include "ResultsManager.h"
#include "Paginator.hpp"
@@ -50,3 +50,4 @@ namespace platform {
lxw_workbook* workbook;
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef PAGINATOR_HPP
#define PAGINATOR_HPP
#include <utility>
class Paginator {
@@ -53,4 +53,5 @@ private:
int total;
int page;
int numPages;
};
};
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef RESULTSMANAGER_H
#define RESULTSMANAGER_H
#include <vector>
#include <string>
#include <nlohmann/json.hpp>
@@ -45,4 +45,5 @@ namespace platform {
int maxTitle;
std::vector<Result> files;
};
};
};
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef DATASETSCONSOLE_H
#define DATASETSCONSOLE_H
#include <locale>
#include <sstream>
#include <nlohmann/json.hpp>
@@ -18,4 +18,4 @@ namespace platform {
void split_lines(int name_len, std::string line, const std::string& balance);
};
}
#endif

View File

@@ -1,5 +1,4 @@
#include "DatasetsExcel.h"
namespace platform {
DatasetsExcel::DatasetsExcel()
{

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef DATASETSEXCEL_H
#define DATASETSEXCEL_H
#include <nlohmann/json.hpp>
#include "reports/ExcelFile.h"
@@ -13,3 +13,4 @@ namespace platform {
void report(json& data);
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef EXCELFILE_H
#define EXCELFILE_H
#include <locale>
#include <string>
#include <map>
@@ -39,3 +39,4 @@ namespace platform {
void setDefault();
};
}
#endif

View File

@@ -1,7 +1,6 @@
#ifndef REPORTBASE_H
#define REPORTBASE_H
//#include "main/Scores.h"
#include <string>
#include <nlohmann/json.hpp>
#include "common/Paths.h"

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef REPORT_CONSOLE_H
#define REPORT_CONSOLE_H
#include <string>
#include "common/Colors.h"
#include <sstream>
@@ -32,3 +32,4 @@ namespace platform {
std::vector<std::string> vbody;
};
};
#endif

View File

@@ -2,8 +2,6 @@
#include <locale>
#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)

View File

@@ -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;
};
};
};
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef REPORTS_PAGED_H
#define REPORTS_PAGED_H
#include <locale>
#include <sstream>
#include <nlohmann/json.hpp>
@@ -23,3 +23,4 @@ namespace platform {
std::locale loc;
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef RESULTSDATASETSCONSOLE_H
#define RESULTSDATASETSCONSOLE_H
#include <locale>
#include <string>
#include <sstream>
@@ -15,7 +15,4 @@ namespace platform {
bool report(const std::string& dataset, const std::string& score, const std::string& model);
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef RESULT_H
#define RESULT_H
#include <map>
#include <vector>
#include <string>
@@ -51,3 +51,4 @@ namespace platform {
double score = 0.0;
};
};
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef RESULTSDATASET_H
#define RESULTSDATASET_H
#include <vector>
#include <string>
#include <nlohmann/json.hpp>
@@ -31,4 +31,5 @@ namespace platform {
double maxResult;
std::vector<Result> files;
};
};
};
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef RESULTSDATASETEXCEL_H
#define RESULTSDATASETEXCEL_H
#include <nlohmann/json.hpp>
#include "reports/ExcelFile.h"
@@ -14,3 +14,4 @@ namespace platform {
void report(json& data);
};
}
#endif

View File

@@ -1,5 +1,5 @@
#pragma once
#ifndef TESTUTILS_H
#define TESTUTILS_H
#include <torch/torch.h>
#include <string>
#include <vector>
@@ -39,4 +39,4 @@ public:
int nSamples, classNumStates;
double epsilon = 1e-5;
};
#endif