changeset 5176:6d8647122ef3

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 24 Mar 2023 19:10:00 +0100
parents 48005e522bd6
children 6807a2b012a0
files OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/Sources/DicomFormat/DicomMap.h OrthancFramework/UnitTestsSources/DicomMapTests.cpp OrthancServer/Sources/Search/DatabaseLookup.cpp OrthancServer/Sources/ServerContext.cpp
diffstat 5 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Fri Mar 24 19:00:33 2023 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Fri Mar 24 19:10:00 2023 +0100
@@ -257,14 +257,14 @@
       return allMainDicomTags_;
     }
 
-    const std::string& GetMainDicomTagsSignature(ResourceType level)
+    std::string GetMainDicomTagsSignature(ResourceType level)
     {
       assert(signatures_.find(level) != signatures_.end());
 
       return signatures_[level];
     }
 
-    const std::string& GetDefaultMainDicomTagsSignature(ResourceType level)
+    std::string GetDefaultMainDicomTagsSignature(ResourceType level)
     {
       assert(defaultSignatures_.find(level) != defaultSignatures_.end());
 
@@ -707,9 +707,9 @@
     target = DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(level);
   }
 
-  const std::set<DicomTag>& DicomMap::GetAllMainDicomTags()
+  void DicomMap::GetAllMainDicomTags(std::set<DicomTag>& target)
   {
-    return DicomMap::MainDicomTagsConfiguration::GetInstance().GetAllMainDicomTags();
+    target = DicomMap::MainDicomTagsConfiguration::GetInstance().GetAllMainDicomTags();
   }
 
   void DicomMap::AddMainDicomTag(const DicomTag& tag, ResourceType level)
@@ -722,12 +722,12 @@
     DicomMap::MainDicomTagsConfiguration::GetInstance().ResetDefaultMainDicomTags();
   }
 
-  const std::string& DicomMap::GetMainDicomTagsSignature(ResourceType level)
+  std::string DicomMap::GetMainDicomTagsSignature(ResourceType level)
   {
     return DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsSignature(level);
   }
 
-  const std::string& DicomMap::GetDefaultMainDicomTagsSignature(ResourceType level)
+  std::string DicomMap::GetDefaultMainDicomTagsSignature(ResourceType level)
   {
     return DicomMap::MainDicomTagsConfiguration::GetInstance().GetDefaultMainDicomTagsSignature(level);
   }
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.h	Fri Mar 24 19:00:33 2023 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.h	Fri Mar 24 19:10:00 2023 +0100
@@ -158,11 +158,11 @@
                                  ResourceType level);
 
     // returns a string uniquely identifying the list of main dicom tags for a level
-    static const std::string& GetMainDicomTagsSignature(ResourceType level);
+    static std::string GetMainDicomTagsSignature(ResourceType level);
 
-    static const std::string& GetDefaultMainDicomTagsSignature(ResourceType level);
+    static std::string GetDefaultMainDicomTagsSignature(ResourceType level);
 
-    static const std::set<DicomTag>& GetAllMainDicomTags();
+    static void GetAllMainDicomTags(std::set<DicomTag>& target);
 
     // adds a main dicom tag to the definition of main dicom tags for each level.
     // this should be done once at startup before you use MainDicomTags methods
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Fri Mar 24 19:00:33 2023 +0100
+++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Fri Mar 24 19:10:00 2023 +0100
@@ -81,7 +81,8 @@
     ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_SOP_INSTANCE_UID));
 
     {
-      const std::set<DicomTag>& s = DicomMap::GetAllMainDicomTags();
+      std::set<DicomTag> s;
+      DicomMap::GetAllMainDicomTags(s);
       ASSERT_TRUE(s.end() != s.find(DICOM_TAG_PATIENT_ID));
       ASSERT_TRUE(s.end() != s.find(DICOM_TAG_STUDY_INSTANCE_UID));
       ASSERT_TRUE(s.end() != s.find(DICOM_TAG_ACCESSION_NUMBER));
--- a/OrthancServer/Sources/Search/DatabaseLookup.cpp	Fri Mar 24 19:00:33 2023 +0100
+++ b/OrthancServer/Sources/Search/DatabaseLookup.cpp	Fri Mar 24 19:10:00 2023 +0100
@@ -281,7 +281,8 @@
 
   bool DatabaseLookup::HasOnlyMainDicomTags() const
   {
-    const std::set<DicomTag>& allMainTags = DicomMap::GetAllMainDicomTags();
+    std::set<DicomTag> allMainTags;
+    DicomMap::GetAllMainDicomTags(allMainTags);
 
     for (size_t i = 0; i < constraints_.size(); i++)
     {
--- a/OrthancServer/Sources/ServerContext.cpp	Fri Mar 24 19:00:33 2023 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri Mar 24 19:10:00 2023 +0100
@@ -551,7 +551,8 @@
     DicomMap summary;
     dicom.GetSummary(summary);   // -> from Orthanc 1.11.1, this includes the leaf nodes and sequences
 
-    std::set<DicomTag> allMainDicomTags = DicomMap::GetAllMainDicomTags();
+    std::set<DicomTag> allMainDicomTags;
+    DicomMap::GetAllMainDicomTags(allMainDicomTags);
 
     try
     {