changeset 1728:4941494b5dd8 db-changes

rename LookupIdentifier as LookupIdentifierExact
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Oct 2015 15:03:52 +0200
parents 1ae29c5e52fb
children 54d78925cbb6
files OrthancServer/DatabaseWrapper.h OrthancServer/DatabaseWrapperBase.cpp OrthancServer/DatabaseWrapperBase.h OrthancServer/IDatabaseWrapper.h OrthancServer/OrthancMoveRequestHandler.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/ResourceFinder.cpp OrthancServer/ServerIndex.cpp OrthancServer/ServerIndex.h Plugins/Engine/OrthancPluginDatabase.cpp Plugins/Engine/OrthancPluginDatabase.h Plugins/Engine/OrthancPlugins.cpp Plugins/Include/orthanc/OrthancCDatabasePlugin.h Plugins/Include/orthanc/OrthancCppDatabasePlugin.h Plugins/Samples/DatabasePlugin/Database.h UnitTestsSources/ServerIndexTests.cpp
diffstat 16 files changed, 68 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- 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<int64_t>& target,
-                                  ResourceType level,
-                                  const DicomTag& tag,
-                                  const std::string& value)
+    virtual void LookupIdentifierExact(std::list<int64_t>& 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<MetadataType, std::string>& target,
--- 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<int64_t>& target,
-                                             ResourceType level,
-                                             const DicomTag& tag,
-                                             const std::string& value)
+  void DatabaseWrapperBase::LookupIdentifierExact(std::list<int64_t>& 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) ||
--- 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<int64_t>& target,
-                          ResourceType level,
-                          const DicomTag& tag,
-                          const std::string& value);
+    void LookupIdentifierExact(std::list<int64_t>& target,
+                               ResourceType level,
+                               const DicomTag& tag,
+                               const std::string& value);
   };
 }
 
--- 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<int64_t>& target,
-                                  ResourceType level,
-                                  const DicomTag& tag,
-                                  const std::string& value) = 0;
+    virtual void LookupIdentifierExact(std::list<int64_t>& target,
+                                       ResourceType level,
+                                       const DicomTag& tag,
+                                       const std::string& value) = 0;
 
     virtual bool LookupMetadata(std::string& target,
                                 int64_t id,
--- 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<std::string> ids;
-    context_.GetIndex().LookupIdentifier(ids, level, tag, value);
+    context_.GetIndex().LookupIdentifierExact(ids, level, tag, value);
 
     if (ids.size() != 1)
     {
--- 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<std::string> tmp;
-    index.LookupIdentifier(tmp, level, tag, value);
+    index.LookupIdentifierExact(tmp, level, tag, value);
 
     for (std::list<std::string>::const_iterator
            it = tmp.begin(); it != tmp.end(); ++it)
--- 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<std::string> resources;
-      index_.LookupIdentifier(resources, level_, tag, value);
+      index_.LookupIdentifierExact(resources, level_, tag, value);
 
       if (isFilterApplied_)
       {
--- 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<std::string>& result,
-                                     ResourceType level,
-                                     const DicomTag& tag,
-                                     const std::string& value)
+  void ServerIndex::LookupIdentifierExact(std::list<std::string>& 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<int64_t> id;
-    db_.LookupIdentifier(id, level, tag, value);
+    db_.LookupIdentifierExact(id, level, tag, value);
 
     for (std::list<int64_t>::const_iterator 
            it = id.begin(); it != id.end(); ++it)
--- 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<std::string>& result,
-                          ResourceType level,
-                          const DicomTag& tag,
-                          const std::string& value);
+    void LookupIdentifierExact(std::list<std::string>& result,
+                               ResourceType level,
+                               const DicomTag& tag,
+                               const std::string& value);
 
     StoreStatus AddAttachment(const FileInfo& attachment,
                               const std::string& publicId);
--- 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<int64_t>& target,
-                                               ResourceType level,
-                                               const DicomTag& tag,
-                                               const std::string& value)
+  void OrthancPluginDatabase::LookupIdentifierExact(std::list<int64_t>& 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);
       }
 
--- 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<int64_t>& target,
-                                  ResourceType level,
-                                  const DicomTag& tag,
-                                  const std::string& value);
+    virtual void LookupIdentifierExact(std::list<int64_t>& target,
+                                       ResourceType level,
+                                       const DicomTag& tag,
+                                       const std::string& value);
 
     virtual bool LookupMetadata(std::string& target,
                                 int64_t id,
--- 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<std::string> result;
-    pimpl_->context_->GetIndex().LookupIdentifier(result, level, tag, p.argument);
+    pimpl_->context_->GetIndex().LookupIdentifierExact(result, level, tag, p.argument);
 
     if (result.size() == 1)
     {
--- 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 */
--- 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<int64_t>& target /*out*/,
-                                  OrthancPluginResourceType resourceType,
-                                  uint16_t group,
-                                  uint16_t element,
-                                  const char* value) = 0;
+    virtual void LookupIdentifierExact(std::list<int64_t>& 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<IDatabaseBackend*>(payload);
       backend->GetOutput().SetAllowedAnswers(DatabaseBackendOutput::AllowedAnswers_None);
@@ -1307,7 +1307,7 @@
       try
       {
         std::list<int64_t> target;
-        backend->LookupIdentifier(target, resourceType, tag->group, tag->element, tag->value);
+        backend->LookupIdentifierExact(target, resourceType, tag->group, tag->element, tag->value);
 
         for (std::list<int64_t>::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, &params, &extensions, &backend);
       if (!context)
--- 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<Orthanc::GlobalProperty>(property));
   }
 
-  virtual void LookupIdentifier(std::list<int64_t>& target /*out*/,
-                                OrthancPluginResourceType level,
-                                uint16_t group,
-                                uint16_t element,
-                                const char* value)
+  virtual void LookupIdentifierExact(std::list<int64_t>& 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*/,
--- 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<int64_t> 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<std::string> 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<std::string>::iterator i = s.begin(); i != s.end(); i++)
     {
     std::cout << "*** " << *i << std::endl;;