Mercurial > hg > orthanc-databases
changeset 129:534759b0cf14
use of macros to report performance warnings
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 08 Feb 2019 20:12:29 +0100 |
parents | 39b2f29ddf3c |
children | 2d2b268799a2 |
files | Framework/Plugins/OrthancCppDatabasePlugin.h Framework/Plugins/PluginInitialization.cpp MySQL/CMakeLists.txt PostgreSQL/CMakeLists.txt Resources/CMake/DatabasesPluginConfiguration.cmake SQLite/CMakeLists.txt |
diffstat | 6 files changed, 55 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Plugins/OrthancCppDatabasePlugin.h Fri Feb 08 19:55:01 2019 +0100 +++ b/Framework/Plugins/OrthancCppDatabasePlugin.h Fri Feb 08 20:12:29 2019 +0100 @@ -1847,10 +1847,13 @@ sprintf(info, "Performance warning: The database index plugin was compiled " "against an old version of the Orthanc SDK (%d.%d.%d): " - "Consider upgrading to version 1.5.4 of the Orthanc SDK", + "Consider upgrading to version %d.%d.%d of the Orthanc SDK", ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, - ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); + ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER, + ORTHANC_OPTIMAL_VERSION_MAJOR, + ORTHANC_OPTIMAL_VERSION_MINOR, + ORTHANC_OPTIMAL_VERSION_REVISION); OrthancPluginLogWarning(context, info); }
--- a/Framework/Plugins/PluginInitialization.cpp Fri Feb 08 19:55:01 2019 +0100 +++ b/Framework/Plugins/PluginInitialization.cpp Fri Feb 08 20:12:29 2019 +0100 @@ -65,9 +65,16 @@ return false; } - if (OrthancPluginCheckVersionAdvanced(context, 1, 5, 4) == 1) + if (OrthancPluginCheckVersionAdvanced(context, 1, 4, 0) == 1) { ImplicitTransaction::SetErrorOnDoubleExecution(true); + } + + if (OrthancPluginCheckVersionAdvanced(context, + ORTHANC_OPTIMAL_VERSION_MAJOR, + ORTHANC_OPTIMAL_VERSION_MINOR, + ORTHANC_OPTIMAL_VERSION_REVISION) == 1) + { isOptimal = true; } @@ -110,9 +117,12 @@ int minor = boost::lexical_cast<int>(tokens[1]); int revision = boost::lexical_cast<int>(tokens[2]); - isOptimal = (major > 1 || - (major == 1 && minor > 5) || - (major == 1 && minor == 5 && revision >= 4)); + isOptimal = (major > ORTHANC_OPTIMAL_VERSION_MAJOR || + (major == ORTHANC_OPTIMAL_VERSION_MAJOR && + minor > ORTHANC_OPTIMAL_VERSION_MINOR) || + (major == ORTHANC_OPTIMAL_VERSION_MAJOR && + minor == ORTHANC_OPTIMAL_VERSION_MINOR && + revision >= ORTHANC_OPTIMAL_VERSION_REVISION)); } } @@ -121,8 +131,11 @@ { LOG(WARNING) << "Performance warning in " << dbms << " index: Your version of Orthanc (" - << context->orthancVersion << ") should be upgraded to 1.5.4 " - << "to benefit from best performance"; + << context->orthancVersion << ") should be upgraded to " + << ORTHANC_OPTIMAL_VERSION_MAJOR << "." + << ORTHANC_OPTIMAL_VERSION_MINOR << "." + << ORTHANC_OPTIMAL_VERSION_REVISION + << " to benefit from best performance"; }
--- a/MySQL/CMakeLists.txt Fri Feb 08 19:55:01 2019 +0100 +++ b/MySQL/CMakeLists.txt Fri Feb 08 20:12:29 2019 +0100 @@ -3,11 +3,15 @@ set(ORTHANC_PLUGIN_VERSION "mainline") +set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) +set(ORTHANC_OPTIMAL_VERSION_MINOR 5) +set(ORTHANC_OPTIMAL_VERSION_REVISION 4) + if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() - set(ORTHANC_FRAMEWORK_VERSION "1.5.4") + set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") endif()
--- a/PostgreSQL/CMakeLists.txt Fri Feb 08 19:55:01 2019 +0100 +++ b/PostgreSQL/CMakeLists.txt Fri Feb 08 20:12:29 2019 +0100 @@ -3,11 +3,15 @@ set(ORTHANC_PLUGIN_VERSION "mainline") +set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) +set(ORTHANC_OPTIMAL_VERSION_MINOR 5) +set(ORTHANC_OPTIMAL_VERSION_REVISION 4) + if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() - set(ORTHANC_FRAMEWORK_VERSION "1.5.4") + set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") endif()
--- a/Resources/CMake/DatabasesPluginConfiguration.cmake Fri Feb 08 19:55:01 2019 +0100 +++ b/Resources/CMake/DatabasesPluginConfiguration.cmake Fri Feb 08 20:12:29 2019 +0100 @@ -44,9 +44,25 @@ endif() +if (NOT DEFINED ORTHANC_OPTIMAL_VERSION_MAJOR) + message(FATAL_ERROR "ORTHANC_OPTIMAL_VERSION_MAJOR is not defined") +endif() + +if (NOT DEFINED ORTHANC_OPTIMAL_VERSION_MINOR) + message(FATAL_ERROR "ORTHANC_OPTIMAL_VERSION_MINOR is not defined") +endif() + +if (NOT DEFINED ORTHANC_OPTIMAL_VERSION_REVISION) + message(FATAL_ERROR "ORTHANC_OPTIMAL_VERSION_REVISION is not defined") +endif() + + add_definitions( -DHAS_ORTHANC_EXCEPTION=1 -DORTHANC_ENABLE_PLUGINS=1 + -DORTHANC_OPTIMAL_VERSION_MAJOR=${ORTHANC_OPTIMAL_VERSION_MAJOR} + -DORTHANC_OPTIMAL_VERSION_MINOR=${ORTHANC_OPTIMAL_VERSION_MINOR} + -DORTHANC_OPTIMAL_VERSION_REVISION=${ORTHANC_OPTIMAL_VERSION_REVISION} )
--- a/SQLite/CMakeLists.txt Fri Feb 08 19:55:01 2019 +0100 +++ b/SQLite/CMakeLists.txt Fri Feb 08 20:12:29 2019 +0100 @@ -3,12 +3,16 @@ set(ORTHANC_PLUGIN_VERSION "mainline") +set(ORTHANC_OPTIMAL_VERSION_MAJOR 1) +set(ORTHANC_OPTIMAL_VERSION_MINOR 5) +set(ORTHANC_OPTIMAL_VERSION_REVISION 4) + if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") set(ORTHANC_FRAMEWORK_VERSION "mainline") set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") else() set(ORTHANC_FRAMEWORK_VERSION "1.4.0") - set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") + set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_OPTIMAL_VERSION_MAJOR}.${ORTHANC_OPTIMAL_VERSION_MINOR}.${ORTHANC_OPTIMAL_VERSION_REVISION}") endif() include(${CMAKE_SOURCE_DIR}/../Resources/CMake/DatabasesPluginParameters.cmake)