comparison Framework/Plugins/IndexBackend.cpp @ 213:c2e4a909de0e

added IndexBackend::Register() to be used in all the index plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 24 Mar 2021 15:59:23 +0100
parents a0c095a4ba7d
children dd6cfc250747
comparison
equal deleted inserted replaced
212:821d4ba83dc3 213:c2e4a909de0e
23 23
24 #include "../../Resources/Orthanc/Databases/ISqlLookupFormatter.h" 24 #include "../../Resources/Orthanc/Databases/ISqlLookupFormatter.h"
25 #include "../Common/BinaryStringValue.h" 25 #include "../Common/BinaryStringValue.h"
26 #include "../Common/Integer64Value.h" 26 #include "../Common/Integer64Value.h"
27 #include "../Common/Utf8StringValue.h" 27 #include "../Common/Utf8StringValue.h"
28 #include "DatabaseBackendAdapterV2.h"
29 #include "DatabaseBackendAdapterV3.h"
28 #include "GlobalProperties.h" 30 #include "GlobalProperties.h"
29 31
30 #include <Compatibility.h> // For std::unique_ptr<> 32 #include <Compatibility.h> // For std::unique_ptr<>
31 #include <Logging.h> 33 #include <Logging.h>
32 #include <OrthancException.h> 34 #include <OrthancException.h>
2206 assert(result.patientId != -1); 2208 assert(result.patientId != -1);
2207 assert(result.studyId != -1); 2209 assert(result.studyId != -1);
2208 assert(result.seriesId != -1); 2210 assert(result.seriesId != -1);
2209 assert(result.instanceId != -1); 2211 assert(result.instanceId != -1);
2210 } 2212 }
2213
2214
2215 void IndexBackend::Register(IndexBackend& backend)
2216 {
2217 OrthancPluginContext* context = backend.GetContext();
2218
2219 bool hasLoadedV3 = false;
2220
2221 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
2222 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
2223 if (OrthancPluginCheckVersionAdvanced(context, 1, 9, 2) == 1)
2224 {
2225 OrthancDatabases::DatabaseBackendAdapterV3::Register(backend);
2226 hasLoadedV3 = true;
2227 }
2228 # endif
2229 #endif
2230
2231 if (!hasLoadedV3)
2232 {
2233 LOG(WARNING) << "Performance warning: Your version of Orthanc doesn't support multiple readers/writers";
2234 OrthancDatabases::DatabaseBackendAdapterV2::Register(backend);
2235 }
2236 }
2211 } 2237 }