diff --git a/GeoModelIO/GeoModelCppHelpers/GeoModelCppHelpers/GMCppHelpers.h b/GeoModelIO/GeoModelCppHelpers/GeoModelCppHelpers/GMCppHelpers.h index f928076a23b60da5967e7b05a704c03dc02200d4..e5bd755210eb4756f9e18914267c9d0a1f771ad2 100644 --- a/GeoModelIO/GeoModelCppHelpers/GeoModelCppHelpers/GMCppHelpers.h +++ b/GeoModelIO/GeoModelCppHelpers/GeoModelCppHelpers/GMCppHelpers.h @@ -72,11 +72,11 @@ namespace GeoModelIO { return s; } - static std::string getEnvVar(std::string const &key) - { - char *val = std::getenv(key.c_str()); - return val == NULL ? std::string("") : std::string(val); - } + // static std::string getEnvVar(std::string const &key) + // { + // char *val = std::getenv(key.c_str()); + // return val == NULL ? std::string("") : std::string(val); + // } // static void printStdVectorVariants(const std::vector<std::variant<int, long, float, double, std::string>> vec) // { diff --git a/GeoModelIO/GeoModelRead/GeoModelRead/ReadGeoModel.h b/GeoModelIO/GeoModelRead/GeoModelRead/ReadGeoModel.h index b1cf2ffe9be16ade6efbbefdf575afe74f4fc393..e1476035da9d34607aa14108f2ea635af846aacb 100644 --- a/GeoModelIO/GeoModelRead/GeoModelRead/ReadGeoModel.h +++ b/GeoModelIO/GeoModelRead/GeoModelRead/ReadGeoModel.h @@ -351,10 +351,9 @@ class ReadGeoModel { GeoSerialTransformer* getBuiltSerialTransformer(const unsigned int id); // Utility functions - std::string getEnvVar(std::string const& key) const; - std::vector<std::string> splitString(const std::string& s, char delimiter); + std::vector<std::string> splitString(const std::string& s, char delimiter); // TODO: move to global helpers void printStdVectorStrings( - std::vector<std::string> vec); // TODO: move it to utility class + std::vector<std::string> vec); // TODO: move it to utility class or move to global helpers // void printTransformationValues(QStringList t); // TODO: move to a Qt // utility class QList<double> convertQstringListToDouble(QStringList diff --git a/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp b/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp index e846708aa62f5d8e20f7fbaade554ab65ea7d883..26ce1de480ebef52335460c16a39b1ebbfb97a68 100644 --- a/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp +++ b/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp @@ -87,6 +87,7 @@ #include "GeoModelHelpers/variantHelpers.h" #include "GeoModelHelpers/throwExcept.h" +#include "GeoModelHelpers/StringUtils.h" // Units #include "GeoModelKernel/Units.h" @@ -145,21 +146,21 @@ ReadGeoModel::ReadGeoModel(GMDBManager* db, unsigned long* progress) m_runMultithreaded_nThreads(0), m_progress(nullptr) { // Check if the user asked for debug messages - if ("" != getEnvVar("GEOMODEL_ENV_IO_LOGLEVEL_1")) { + if ("" != GeoStrUtils::getEnvVar("GEOMODEL_ENV_IO_LOGLEVEL_1")) { m_loglevel = 1; std::cout << "You defined the GEOMODEL_ENV_IO_DEBUG variable, so you " "will see a verbose output." << std::endl; } // Check if the user asked for verbose debug messages - if ("" != getEnvVar("GEOMODEL_ENV_IO_LOGLEVEL_2")) { + if ("" != GeoStrUtils::getEnvVar("GEOMODEL_ENV_IO_LOGLEVEL_2")) { m_loglevel = 2; std::cout << "You defined the GEOMODEL_ENV_IO_READ_DEBUG_VERBOSE " "variable, so you will see a verbose output." << std::endl; } // Check if the user asked for timing output - if ("" != getEnvVar("GEOMODEL_ENV_IO_READ_TIMING")) { + if ("" != GeoStrUtils::getEnvVar("GEOMODEL_ENV_IO_READ_TIMING")) { m_timing = true; std::cout << "You defined the GEOMODEL_ENV_IO_READ_TIMING variable, so " "you will see a timing measurement in the output." @@ -186,8 +187,8 @@ ReadGeoModel::ReadGeoModel(GMDBManager* db, unsigned long* progress) // m_builderShape_Box = std::make_unique<BuildGeoShapes_Box>(); // Check if the user asked for running in serial or multi-threading mode - if ("" != getEnvVar("GEOMODEL_ENV_IO_NTHREADS")) { - int nThreads = std::stoi(getEnvVar("GEOMODEL_ENV_IO_NTHREADS")); + if ("" != GeoStrUtils::getEnvVar("GEOMODEL_ENV_IO_NTHREADS")) { + int nThreads = std::stoi(GeoStrUtils::getEnvVar("GEOMODEL_ENV_IO_NTHREADS")); if (nThreads == 0) { std::cout << "Info: You set the GEOMODEL_ENV_IO_NTHREADS to '" << nThreads @@ -248,11 +249,11 @@ ReadGeoModel::~ReadGeoModel() { m_builderShape_UnidentifiedShape = nullptr; } -// FIXME: TODO: move to an utility class -std::string ReadGeoModel::getEnvVar(std::string const& key) const { - char* val = std::getenv(key.c_str()); - return val == NULL ? std::string("") : std::string(val); -} +// // FIXME: TODO: move to an utility class +// std::string ReadGeoModel::getEnvVar(std::string const& key) const { +// char* val = std::getenv(key.c_str()); +// return val == NULL ? std::string("") : std::string(val); +// } const GeoVPhysVol* ReadGeoModel::buildGeoModel() { if (m_loglevel >= 2)