# HG changeset patch # User Sebastien Jodogne # Date 1545320947 -3600 # Node ID 39db63e68dcfcf8fdaad12a820c5f3f550e70338 # Parent d8a91acb74241dfa70357b1b394e6f211293744d fix build diff -r d8a91acb7424 -r 39db63e68dcf Plugins/Engine/OrthancPluginDatabase.cpp --- a/Plugins/Engine/OrthancPluginDatabase.cpp Thu Dec 20 16:42:35 2018 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.cpp Thu Dec 20 16:49:07 2018 +0100 @@ -1118,4 +1118,56 @@ { throw OrthancException(ErrorCode_NotImplemented); } + + + void OrthancPluginDatabase::LookupIdentifier(std::list& result, + ResourceType level, + const DicomTag& tag, + IdentifierConstraintType type, + const std::string& value) + { + if (extensions_.lookupIdentifier3 == NULL) + { + throw OrthancException(ErrorCode_DatabasePlugin, + "The database plugin does not implement the LookupIdentifier3 primitive"); + } + + OrthancPluginDicomTag tmp; + tmp.group = tag.GetGroup(); + tmp.element = tag.GetElement(); + tmp.value = value.c_str(); + + ResetAnswers(); + CheckSuccess(extensions_.lookupIdentifier3(GetContext(), payload_, Plugins::Convert(level), + &tmp, Plugins::Convert(type))); + ForwardAnswers(result); + } + + + void OrthancPluginDatabase::LookupIdentifierRange(std::list& result, + ResourceType level, + const DicomTag& tag, + const std::string& start, + const std::string& end) + { + if (extensions_.lookupIdentifierRange == NULL) + { + // Default implementation, for plugins using Orthanc SDK <= 1.3.2 + + LookupIdentifier(result, level, tag, IdentifierConstraintType_GreaterOrEqual, start); + + std::list b; + LookupIdentifier(result, level, tag, IdentifierConstraintType_SmallerOrEqual, end); + + result.splice(result.end(), b); + } + else + { + ResetAnswers(); + CheckSuccess(extensions_.lookupIdentifierRange(GetContext(), payload_, Plugins::Convert(level), + tag.GetGroup(), tag.GetElement(), + start.c_str(), end.c_str())); + ForwardAnswers(result); + } + } } diff -r d8a91acb7424 -r 39db63e68dcf Plugins/Engine/OrthancPluginDatabase.h --- a/Plugins/Engine/OrthancPluginDatabase.h Thu Dec 20 16:42:35 2018 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.h Thu Dec 20 16:49:07 2018 +0100 @@ -36,13 +36,13 @@ #if ORTHANC_ENABLE_PLUGINS == 1 #include "../../Core/SharedLibrary.h" -#include "../../OrthancServer/IDatabaseWrapper.h" +#include "../../OrthancServer/Search/Compatibility/CompatibilityDatabaseWrapper.h" #include "../Include/orthanc/OrthancCDatabasePlugin.h" #include "PluginsErrorDictionary.h" namespace Orthanc { - class OrthancPluginDatabase : public IDatabaseWrapper + class OrthancPluginDatabase : public CompatibilityDatabaseWrapper { private: class Transaction; @@ -306,8 +306,7 @@ IStorageArea& storageArea) ORTHANC_OVERRIDE; - void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer) - ORTHANC_OVERRIDE; + void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer); virtual bool IsDiskSizeAbove(uint64_t threshold) ORTHANC_OVERRIDE;