diff --git a/GeoModelDBManager/CMakeLists.txt b/GeoModelDBManager/CMakeLists.txt index ddc72a3cfca5a56d87457e14b6201bcca0023b6e..f601567a1f00296e4698c137bd4dd407ad9b8ba7 100644 --- a/GeoModelDBManager/CMakeLists.txt +++ b/GeoModelDBManager/CMakeLists.txt @@ -12,7 +12,7 @@ file( GLOB HEADERS GeoModelDBManager/*.h fmt/*.h ) # Set up the library. add_library( GeoModelDBManager SHARED ${HEADERS} ${SOURCES} ) -target_link_libraries( GeoModelDBManager PUBLIC Qt5::Sql ) +# target_link_libraries( GeoModelDBManager PUBLIC ) target_link_libraries( GeoModelDBManager LINK_PUBLIC sqlite3 ) # target_link_libraries( GeoModelDBManager PUBLIC Qt5::Sql ) diff --git a/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelDBManager/GeoModelDBManager/GMDBManager.h index 8743447184056a06d40e10912e8bd56af10ced45..32765c558ce7a193494e1de7f550c7d8477986b8 100644 --- a/GeoModelDBManager/GeoModelDBManager/GMDBManager.h +++ b/GeoModelDBManager/GeoModelDBManager/GMDBManager.h @@ -7,16 +7,9 @@ //#include "GeoModelKernel/GeoNodeAction.h" //#include "GeoModelKernel/GeoGraphNode.h" -// include Qt -#include <QSqlDatabase> -#include <QStringList> -#include <QVariant> -#include <QString> -#include <QMap> - +// include SQLite #include <sqlite3.h> - // include C++ #include <iostream> #include <unordered_map> @@ -143,30 +136,30 @@ public: */ void printDBVersion() const; - + void printAllDBTables(); void getAllDBTables(); int execQuery(std::string queryStr); bool addListOfRecords(const std::string geoType, const std::vector<std::vector<std::string>> records); - + bool addListOfRecordsToTable(const std::string tableName, const std::vector<std::vector<std::string>> records); - + // bool addListOfRecordsToTableOld(const QString tableName, const std::vector<QStringList> records); // for the old SQlite only bool addListOfChildrenPositions(const std::vector<std::vector<std::string>> &records); bool addRootVolume(const std::vector<std::string> &values); - + // GET methods std::string getDBFilePath(); std::vector<std::string> getRootPhysVol(); - + std::vector<std::string> getItemFromTableName(std::string tableName, unsigned int id); - + std::vector<std::string> getItemAndType(unsigned int tableId, unsigned int id); std::string getNodeTypeFromTableId(unsigned int id); @@ -176,29 +169,29 @@ public: std::vector<std::vector<std::string>> getChildrenTable(); std::vector<std::vector<std::string>> getTableFromNodeType(std::string nodeType); - + std::unordered_map<unsigned int, std::string> getAll_TableIDsNodeTypes(); std::unordered_map<std::string, unsigned int> getAll_NodeTypesTableIDs(); - + std::vector<std::vector<std::string>> getTableRecords(std::string tableName) const; // TODO: should be private? private: bool createTables(); - + void addDBversion(std::string version); - + // void loadTestData(); // for debug only std::string getTableNameFromTableId(unsigned int tabId); - + unsigned int getTableIdFromNodeType(const std::string &nodeType); void storeNodeType(std::string nodeType, std::string tableName); - + std::string getTableNameFromNodeType(const std::string &nodeType); sqlite3_stmt* selectAllFromTable(std::string tableName) const; @@ -206,7 +199,7 @@ private: sqlite3_stmt* selectAllFromTableChildrenPositions() const; void storeTableColumnNames(std::vector<std::string> input); - + std::vector<std::string> getTableColumnNames(const std::string &tableName); void printAllRecords(const std::string &tableName) const; @@ -215,24 +208,24 @@ private: bool storeRootVolume(const unsigned int &id, const std::string &nodeType); - void showError(const QSqlError &err) const; +// void showError(const QSqlError &err) const; std::string m_dbpath; - + // QSqlDatabase m_db; /// Pointer to SQLite connection sqlite3* m_dbSqlite; /// Variable to store error messages from SQLite char *m_SQLiteErrMsg; - - + + bool m_dbIsOK; bool m_debug; std::unordered_map<std::string, std::vector<std::string>> m_tableNames; /// stores the column names for each table std::unordered_map<std::string, std::string> m_childType_tableName; - + std::vector<std::string> m_cache_tables; /// cache for the list of tables in the DB std::unordered_map<unsigned int, std::string> m_cache_tableId_tableName; /// cache for tableID-->tableName std::unordered_map<unsigned int, std::string> m_cache_tableId_nodeType; /// cache for tableID-->nodeType diff --git a/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelDBManager/src/GMDBManager.cpp index 5189dff460f23ac05ba81e61f956a9ca75b8f609..437fe9c1c718f03306dd85fadf2dd76c328964bc 100644 --- a/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelDBManager/src/GMDBManager.cpp @@ -21,15 +21,15 @@ static std::string dbversion = "0.4.0"; // removed "parent" info from [Full]PhysVols tables (May 2020) -// FIXME: move this to utility class/file -std::vector<std::string> toStdVectorStrings(QStringList qlist) -{ - std::vector<std::string> vec; - foreach(QString qstr, qlist) { - vec.push_back(qstr.toStdString()); - } - return vec; -} +//// FIXME: move this to utility class/file +//std::vector<std::string> toStdVectorStrings(QStringList qlist) +//{ +// std::vector<std::string> vec; +// foreach(QString qstr, qlist) { +// vec.push_back(qstr.toStdString()); +// } +// return vec; +//} // FIXME: TODO: move to an utility class std::string getEnvVar( std::string const & key ) diff --git a/GeoModelRead/CMakeLists.txt b/GeoModelRead/CMakeLists.txt index a06cf38fbe04ce6c8bbb772b06339bce1e25671f..0bffad89bdbda9a065e8d83edef66a1c8ab9cf58 100644 --- a/GeoModelRead/CMakeLists.txt +++ b/GeoModelRead/CMakeLists.txt @@ -11,7 +11,7 @@ file( GLOB HEADERS GeoModelRead/*.h ) # Set up the library. add_library( GeoModelRead SHARED ${HEADERS} ${SOURCES} ) -target_link_libraries( GeoModelRead PUBLIC Qt5::Core +target_link_libraries( GeoModelRead PUBLIC GeoModelCore::GeoModelKernel GeoModelDBManager TFPersistification ) target_include_directories( GeoModelRead PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> diff --git a/GeoModelRead/src/ReadGeoModel.cpp b/GeoModelRead/src/ReadGeoModel.cpp index 626bad84a2e69fd6e85059f2d7510be6b8d1bbac..811905aa0d9b894584ac427651f26380d30a728b 100644 --- a/GeoModelRead/src/ReadGeoModel.cpp +++ b/GeoModelRead/src/ReadGeoModel.cpp @@ -908,7 +908,7 @@ GeoElement* ReadGeoModel::buildElement(const unsigned int id) } if (m_elements.size() == 0) - qFatal("ERROR! 'm_elements' is empty! Did you load the 'Elements' table? \n\t ==> Aborting..."); + std::cout << "ERROR! 'm_elements' is empty! Did you load the 'Elements' table? \n\t ==> Aborting...\n" << std::endl; std::vector<std::string> values = m_elements[id-1]; @@ -1513,7 +1513,7 @@ GeoShape* ReadGeoModel::buildShape(const unsigned int shapeId, type_shapes_boole if (varName == "nFacets") nFacets = std::stoi(varValue); else { muxCout.lock(); - qWarning("ERROR!! - GeoTessellatedSolid - nFacets is not defined!!"); +// qWarning("ERROR!! - GeoTessellatedSolid - nFacets is not defined!!"); muxCout.unlock(); error = true; // TODO: check "error.h" functionalities and replace with that, if useful } diff --git a/GeoModelWrite/CMakeLists.txt b/GeoModelWrite/CMakeLists.txt index 1a097793f456edeba2a80129478cc178a94f864f..0e0f17efe5197e465ea4a3c5d7846867be1d0533 100644 --- a/GeoModelWrite/CMakeLists.txt +++ b/GeoModelWrite/CMakeLists.txt @@ -6,7 +6,7 @@ file( GLOB HEADERS GeoModelWrite/*.h ) # Set up the library. add_library( GeoModelWrite SHARED ${HEADERS} ${SOURCES} ) -target_link_libraries( GeoModelWrite PUBLIC Qt5::Core +target_link_libraries( GeoModelWrite PUBLIC GeoModelCore::GeoModelKernel GeoModelDBManager TFPersistification ) target_include_directories( GeoModelWrite PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> diff --git a/GeoModelWrite/src/WriteGeoModel.cpp b/GeoModelWrite/src/WriteGeoModel.cpp index 2454c0fd7eadefc47a860d58678261a8c60ba4da..a85161b14f39a4d19a1d4aa90d79a0d858a273df 100644 --- a/GeoModelWrite/src/WriteGeoModel.cpp +++ b/GeoModelWrite/src/WriteGeoModel.cpp @@ -297,7 +297,7 @@ void WriteGeoModel::handleVPhysVolObjects(const GeoVPhysVol* vol) // Now we get the 'copy number' for this volume, // to distinguish this volume from the other volumes created from the same shared node (if any) - if (volTypeStr == "NULL") qFatal("ERROR!! volTypeStr is 'NULL'!!!"); + if (volTypeStr == "NULL") std::cout << "ERROR!! volTypeStr is 'NULL'!!!\n"; const unsigned int volCopyN = setVolumeCopyNumber(physId, volTypeStr); //JFB Commented out: qDebug() << "physId: " << physId << "- volume copy number: " << volCopyN; @@ -418,8 +418,8 @@ void WriteGeoModel::handleSerialTransformer (const GeoSerialTransformer *node) std::string expression = persistifier.getCodedString(); if (expression.size() == 0) { - qFatal("FATAL ERROR!! Function expression is empty!! Aborting..."); - abort(); + std::cout << "FATAL ERROR!! Function expression is empty!! Aborting...\n"; + exit(EXIT_FAILURE); }