# HG changeset patch # User Sebastien Jodogne # Date 1445346232 -7200 # Node ID 4941494b5dd816ec1613d65906d89a7bac3b7f8e # Parent 1ae29c5e52fbb9f3cace36d17f993c6fd42719f9 rename LookupIdentifier as LookupIdentifierExact diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/DatabaseWrapper.h --- a/OrthancServer/DatabaseWrapper.h Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/DatabaseWrapper.h Tue Oct 20 15:03:52 2015 +0200 @@ -315,12 +315,12 @@ return base_.IsExistingResource(internalId); } - virtual void LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& value) + virtual void LookupIdentifierExact(std::list& target, + ResourceType level, + const DicomTag& tag, + const std::string& value) { - base_.LookupIdentifier(target, level, tag, value); + base_.LookupIdentifierExact(target, level, tag, value); } virtual void GetAllMetadata(std::map& target, diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/DatabaseWrapperBase.cpp --- a/OrthancServer/DatabaseWrapperBase.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/DatabaseWrapperBase.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -665,10 +665,10 @@ } - void DatabaseWrapperBase::LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& value) + void DatabaseWrapperBase::LookupIdentifierExact(std::list& target, + ResourceType level, + const DicomTag& tag, + const std::string& value) { assert((level == ResourceType_Patient && tag == DICOM_TAG_PATIENT_ID) || (level == ResourceType_Study && tag == DICOM_TAG_STUDY_INSTANCE_UID) || diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/DatabaseWrapperBase.h --- a/OrthancServer/DatabaseWrapperBase.h Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/DatabaseWrapperBase.h Tue Oct 20 15:03:52 2015 +0200 @@ -190,10 +190,10 @@ bool IsExistingResource(int64_t internalId); - void LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& value); + void LookupIdentifierExact(std::list& target, + ResourceType level, + const DicomTag& tag, + const std::string& value); }; } diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/IDatabaseWrapper.h --- a/OrthancServer/IDatabaseWrapper.h Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/IDatabaseWrapper.h Tue Oct 20 15:03:52 2015 +0200 @@ -146,10 +146,10 @@ virtual bool LookupGlobalProperty(std::string& target, GlobalProperty property) = 0; - virtual void LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& value) = 0; + virtual void LookupIdentifierExact(std::list& target, + ResourceType level, + const DicomTag& tag, + const std::string& value) = 0; virtual bool LookupMetadata(std::string& target, int64_t id, diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/OrthancMoveRequestHandler.cpp --- a/OrthancServer/OrthancMoveRequestHandler.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -141,7 +141,7 @@ std::string value = input.GetValue(tag).AsString(); std::list ids; - context_.GetIndex().LookupIdentifier(ids, level, tag, value); + context_.GetIndex().LookupIdentifierExact(ids, level, tag, value); if (ids.size() != 1) { diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -892,7 +892,7 @@ ResourceType level) { std::list tmp; - index.LookupIdentifier(tmp, level, tag, value); + index.LookupIdentifierExact(tmp, level, tag, value); for (std::list::const_iterator it = tmp.begin(); it != tmp.end(); ++it) diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/ResourceFinder.cpp --- a/OrthancServer/ResourceFinder.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/ResourceFinder.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -160,7 +160,7 @@ << FromDcmtkBridge::GetName(tag) << " (value: " << value << ")"; std::list resources; - index_.LookupIdentifier(resources, level_, tag, value); + index_.LookupIdentifierExact(resources, level_, tag, value); if (isFilterApplied_) { diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/ServerIndex.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -1888,10 +1888,10 @@ - void ServerIndex::LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& value) + void ServerIndex::LookupIdentifierExact(std::list& result, + ResourceType level, + const DicomTag& tag, + const std::string& value) { assert((level == ResourceType_Patient && tag == DICOM_TAG_PATIENT_ID) || (level == ResourceType_Study && tag == DICOM_TAG_STUDY_INSTANCE_UID) || @@ -1904,7 +1904,7 @@ boost::mutex::scoped_lock lock(mutex_); std::list id; - db_.LookupIdentifier(id, level, tag, value); + db_.LookupIdentifierExact(id, level, tag, value); for (std::list::const_iterator it = id.begin(); it != id.end(); ++it) diff -r 1ae29c5e52fb -r 4941494b5dd8 OrthancServer/ServerIndex.h --- a/OrthancServer/ServerIndex.h Tue Oct 20 14:50:10 2015 +0200 +++ b/OrthancServer/ServerIndex.h Tue Oct 20 15:03:52 2015 +0200 @@ -235,10 +235,10 @@ /* out */ unsigned int& countInstances, const std::string& publicId); - void LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& value); + void LookupIdentifierExact(std::list& result, + ResourceType level, + const DicomTag& tag, + const std::string& value); StoreStatus AddAttachment(const FileInfo& attachment, const std::string& publicId); diff -r 1ae29c5e52fb -r 4941494b5dd8 Plugins/Engine/OrthancPluginDatabase.cpp --- a/Plugins/Engine/OrthancPluginDatabase.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/Plugins/Engine/OrthancPluginDatabase.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -594,10 +594,10 @@ } - void OrthancPluginDatabase::LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& value) + void OrthancPluginDatabase::LookupIdentifierExact(std::list& target, + ResourceType level, + const DicomTag& tag, + const std::string& value) { ResetAnswers(); @@ -606,17 +606,18 @@ tmp.element = tag.GetElement(); tmp.value = value.c_str(); - if (extensions_.lookupIdentifier3 != NULL) + if (extensions_.lookupIdentifierExact != NULL) { - CheckSuccess(extensions_.lookupIdentifier3(GetContext(), payload_, Plugins::Convert(level), &tmp)); + CheckSuccess(extensions_.lookupIdentifierExact(GetContext(), payload_, Plugins::Convert(level), &tmp)); ForwardAnswers(target); } else { - // Emulate "lookupIdentifier3" if unavailable + // Emulate "lookupIdentifierExact" if unavailable if (backend_.lookupIdentifier == NULL) { + LOG(ERROR) << "The plugin does not have the extension \"lookupIdentifierExact\""; throw OrthancException(ErrorCode_DatabasePlugin); } diff -r 1ae29c5e52fb -r 4941494b5dd8 Plugins/Engine/OrthancPluginDatabase.h --- a/Plugins/Engine/OrthancPluginDatabase.h Tue Oct 20 14:50:10 2015 +0200 +++ b/Plugins/Engine/OrthancPluginDatabase.h Tue Oct 20 15:03:52 2015 +0200 @@ -203,10 +203,10 @@ virtual bool LookupGlobalProperty(std::string& target, GlobalProperty property); - virtual void LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& value); + virtual void LookupIdentifierExact(std::list& target, + ResourceType level, + const DicomTag& tag, + const std::string& value); virtual bool LookupMetadata(std::string& target, int64_t id, diff -r 1ae29c5e52fb -r 4941494b5dd8 Plugins/Engine/OrthancPlugins.cpp --- a/Plugins/Engine/OrthancPlugins.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -895,7 +895,7 @@ CheckContextAvailable(); std::list result; - pimpl_->context_->GetIndex().LookupIdentifier(result, level, tag, p.argument); + pimpl_->context_->GetIndex().LookupIdentifierExact(result, level, tag, p.argument); if (result.size() == 1) { diff -r 1ae29c5e52fb -r 4941494b5dd8 Plugins/Include/orthanc/OrthancCDatabasePlugin.h --- a/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Tue Oct 20 14:50:10 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Tue Oct 20 15:03:52 2015 +0200 @@ -522,7 +522,7 @@ void* payload, int32_t property); - /* Use "OrthancPluginDatabaseExtensions::lookupIdentifier3" + /* Use "OrthancPluginDatabaseExtensions::lookupIdentifierExact" instead of this function as of Orthanc 0.9.5 (db v6), can be set to NULL. Output: Use OrthancPluginDatabaseAnswerInt64() */ OrthancPluginErrorCode (*lookupIdentifier) ( @@ -665,7 +665,7 @@ int64_t id); /* Output: Use OrthancPluginDatabaseAnswerInt64() */ - OrthancPluginErrorCode (*lookupIdentifier3) ( + OrthancPluginErrorCode (*lookupIdentifierExact) ( /* outputs */ OrthancPluginDatabaseContext* context, /* inputs */ diff -r 1ae29c5e52fb -r 4941494b5dd8 Plugins/Include/orthanc/OrthancCppDatabasePlugin.h --- a/Plugins/Include/orthanc/OrthancCppDatabasePlugin.h Tue Oct 20 14:50:10 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCppDatabasePlugin.h Tue Oct 20 15:03:52 2015 +0200 @@ -409,11 +409,11 @@ * SeriesInstanceUID (0x0020, 0x000e), SOPInstanceUID (0x0008, * 0x0018) or AccessionNumber (0x0008, 0x0050). **/ - virtual void LookupIdentifier(std::list& target /*out*/, - OrthancPluginResourceType resourceType, - uint16_t group, - uint16_t element, - const char* value) = 0; + virtual void LookupIdentifierExact(std::list& target /*out*/, + OrthancPluginResourceType resourceType, + uint16_t group, + uint16_t element, + const char* value) = 0; virtual bool LookupMetadata(std::string& target /*out*/, int64_t id, @@ -1296,10 +1296,10 @@ } - static OrthancPluginErrorCode LookupIdentifier(OrthancPluginDatabaseContext* context, - void* payload, - OrthancPluginResourceType resourceType, - const OrthancPluginDicomTag* tag) + static OrthancPluginErrorCode LookupIdentifierExact(OrthancPluginDatabaseContext* context, + void* payload, + OrthancPluginResourceType resourceType, + const OrthancPluginDicomTag* tag) { IDatabaseBackend* backend = reinterpret_cast(payload); backend->GetOutput().SetAllowedAnswers(DatabaseBackendOutput::AllowedAnswers_None); @@ -1307,7 +1307,7 @@ try { std::list target; - backend->LookupIdentifier(target, resourceType, tag->group, tag->element, tag->value); + backend->LookupIdentifierExact(target, resourceType, tag->group, tag->element, tag->value); for (std::list::const_iterator it = target.begin(); it != target.end(); ++it) @@ -1848,7 +1848,7 @@ extensions.getDatabaseVersion = GetDatabaseVersion; extensions.upgradeDatabase = UpgradeDatabase; extensions.clearMainDicomTags = ClearMainDicomTags; - extensions.lookupIdentifier3 = LookupIdentifier; // New in Orthanc 0.9.5 (db v6) + extensions.lookupIdentifierExact = LookupIdentifierExact; // New in Orthanc 0.9.5 (db v6) OrthancPluginDatabaseContext* database = OrthancPluginRegisterDatabaseBackendV2(context, ¶ms, &extensions, &backend); if (!context) diff -r 1ae29c5e52fb -r 4941494b5dd8 Plugins/Samples/DatabasePlugin/Database.h --- a/Plugins/Samples/DatabasePlugin/Database.h Tue Oct 20 14:50:10 2015 +0200 +++ b/Plugins/Samples/DatabasePlugin/Database.h Tue Oct 20 15:03:52 2015 +0200 @@ -187,14 +187,14 @@ return base_.LookupGlobalProperty(target, static_cast(property)); } - virtual void LookupIdentifier(std::list& target /*out*/, - OrthancPluginResourceType level, - uint16_t group, - uint16_t element, - const char* value) + virtual void LookupIdentifierExact(std::list& target /*out*/, + OrthancPluginResourceType level, + uint16_t group, + uint16_t element, + const char* value) { - base_.LookupIdentifier(target, Orthanc::Plugins::Convert(level), - Orthanc::DicomTag(group, element), value); + base_.LookupIdentifierExact(target, Orthanc::Plugins::Convert(level), + Orthanc::DicomTag(group, element), value); } virtual bool LookupMetadata(std::string& target /*out*/, diff -r 1ae29c5e52fb -r 4941494b5dd8 UnitTestsSources/ServerIndexTests.cpp --- a/UnitTestsSources/ServerIndexTests.cpp Tue Oct 20 14:50:10 2015 +0200 +++ b/UnitTestsSources/ServerIndexTests.cpp Tue Oct 20 15:03:52 2015 +0200 @@ -693,29 +693,29 @@ std::list s; - index_->LookupIdentifier(s, ResourceType_Study, DICOM_TAG_STUDY_INSTANCE_UID, "0"); + index_->LookupIdentifierExact(s, ResourceType_Study, DICOM_TAG_STUDY_INSTANCE_UID, "0"); ASSERT_EQ(2u, s.size()); ASSERT_TRUE(std::find(s.begin(), s.end(), a[0]) != s.end()); ASSERT_TRUE(std::find(s.begin(), s.end(), a[2]) != s.end()); - index_->LookupIdentifier(s, ResourceType_Series, DICOM_TAG_SERIES_INSTANCE_UID, "0"); + index_->LookupIdentifierExact(s, ResourceType_Series, DICOM_TAG_SERIES_INSTANCE_UID, "0"); ASSERT_EQ(1u, s.size()); ASSERT_TRUE(std::find(s.begin(), s.end(), a[3]) != s.end()); - index_->LookupIdentifier(s, ResourceType_Study, DICOM_TAG_STUDY_INSTANCE_UID, "1"); + index_->LookupIdentifierExact(s, ResourceType_Study, DICOM_TAG_STUDY_INSTANCE_UID, "1"); ASSERT_EQ(1u, s.size()); ASSERT_TRUE(std::find(s.begin(), s.end(), a[1]) != s.end()); - index_->LookupIdentifier(s, ResourceType_Study, DICOM_TAG_STUDY_INSTANCE_UID, "1"); + index_->LookupIdentifierExact(s, ResourceType_Study, DICOM_TAG_STUDY_INSTANCE_UID, "1"); ASSERT_EQ(1u, s.size()); ASSERT_TRUE(std::find(s.begin(), s.end(), a[1]) != s.end()); - index_->LookupIdentifier(s, ResourceType_Series, DICOM_TAG_SERIES_INSTANCE_UID, "1"); + index_->LookupIdentifierExact(s, ResourceType_Series, DICOM_TAG_SERIES_INSTANCE_UID, "1"); ASSERT_EQ(0u, s.size()); /*{ std::list s; - context.GetIndex().LookupIdentifier(s, DICOM_TAG_STUDY_INSTANCE_UID, "1.2.250.1.74.20130819132500.29000036381059"); + context.GetIndex().LookupIdentifierExact(s, DICOM_TAG_STUDY_INSTANCE_UID, "1.2.250.1.74.20130819132500.29000036381059"); for (std::list::iterator i = s.begin(); i != s.end(); i++) { std::cout << "*** " << *i << std::endl;;