Mercurial > hg > orthanc-databases
diff PostgreSQL/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 | 9e419261f1c9 |
children | c0cb5d2cd696 |
line wrap: on
line diff
--- a/PostgreSQL/Plugins/StoragePlugin.cpp Thu Jul 12 10:44:17 2018 +0200 +++ b/PostgreSQL/Plugins/StoragePlugin.cpp Thu Jul 12 12:17:39 2018 +0200 @@ -19,44 +19,22 @@ **/ -#include "../../Framework/Plugins/StorageBackend.h" #include "PostgreSQLStorageArea.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 PostgreSQL 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, "PostgreSQL storage area", + "Stores the Orthanc storage area into a PostgreSQL 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 PostgreSQL database."); - OrthancPlugins::OrthancConfiguration configuration(context); if (!configuration.IsSection("PostgreSQL"))