Mercurial > hg > orthanc-databases
diff MySQL/Plugins/StoragePlugin.cpp @ 24:17f849b2af34
sharing plugin initialization code
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Jul 2018 12:17:39 +0200 |
parents | 54ea251aed70 |
children | c0cb5d2cd696 |
line wrap: on
line diff
--- a/MySQL/Plugins/StoragePlugin.cpp Thu Jul 12 10:44:17 2018 +0200 +++ b/MySQL/Plugins/StoragePlugin.cpp Thu Jul 12 12:17:39 2018 +0200 @@ -21,42 +21,22 @@ #include "MySQLStorageArea.h" #include "../../Framework/MySQL/MySQLDatabase.h" +#include "../../Framework/Plugins/PluginInitialization.h" #include <Core/Logging.h> -static bool DisplayPerformanceWarning() -{ - (void) DisplayPerformanceWarning; // Disable warning about unused function - LOG(WARNING) << "Performance warning in MySQL storage area: " - << "Non-release build, runtime debug assertions are turned on"; - return true; -} - - extern "C" { ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) { - Orthanc::Logging::Initialize(context); - - assert(DisplayPerformanceWarning()); - - /* Check the version of the Orthanc core */ - if (OrthancPluginCheckVersion(context) == 0) + if (!OrthancDatabases::InitializePlugin + (context, "MySQL storage area", + "Stores the Orthanc storage area into a MySQL database.")) { - char info[1024]; - sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin", - context->orthancVersion, - ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, - ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, - ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); - OrthancPluginLogError(context, info); return -1; } - OrthancPluginSetDescription(context, "Stores the Orthanc storage area into a MySQL database."); - OrthancPlugins::OrthancConfiguration configuration(context); if (!configuration.IsSection("MySQL"))