Mercurial > hg > orthanc
changeset 3051:39db63e68dcf db-changes
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Dec 2018 16:49:07 +0100 |
parents | d8a91acb7424 |
children | c7db469bbe8e |
files | Plugins/Engine/OrthancPluginDatabase.cpp Plugins/Engine/OrthancPluginDatabase.h |
diffstat | 2 files changed, 55 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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<int64_t>& 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<int64_t>& 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<int64_t> 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); + } + } }
--- 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;