Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPluginDatabase.cpp @ 3051:39db63e68dcf db-changes
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Dec 2018 16:49:07 +0100 |
parents | 53d583d2c775 |
children | c7db469bbe8e |
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); + } + } }