changeset 4588:94147ce2f097 db-changes

fix build on os x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Mar 2021 17:15:01 +0100
parents 888868a5dc4e
children bec74e29f86b
files OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h OrthancServer/Sources/OrthancWebDav.cpp OrthancServer/Sources/ServerIndex.cpp OrthancServer/Sources/ServerJobs/ArchiveJob.cpp
diffstat 5 files changed, 4 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Wed Mar 10 15:59:03 2021 +0100
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Wed Mar 10 17:15:01 2021 +0100
@@ -420,28 +420,6 @@
 #endif
 
   
-  static inline uint16_t GetCharValue(char c)
-  {
-    if (c >= '0' && c <= '9')
-      return c - '0';
-    else if (c >= 'a' && c <= 'f')
-      return c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F')
-      return c - 'A' + 10;
-    else
-      return 0;
-  }
-
-  
-  static inline uint16_t GetTagValue(const char* c)
-  {
-    return ((GetCharValue(c[0]) << 12) + 
-            (GetCharValue(c[1]) << 8) + 
-            (GetCharValue(c[2]) << 4) + 
-            GetCharValue(c[3]));
-  }
-
-
 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
   void ParsedDicomFile::SendPathValue(RestApiOutput& output,
                                       const UriComponents& uri) const
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Wed Mar 10 15:59:03 2021 +0100
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Wed Mar 10 17:15:01 2021 +0100
@@ -45,7 +45,7 @@
 {
   class DatabaseLookup;
   class ParsedDicomFile;
-  class ServerIndexChange;
+  struct ServerIndexChange;
 
   class StatelessDatabaseOperations : public boost::noncopyable
   {
@@ -408,7 +408,7 @@
     boost::mutex                                 databaseMutex_;  // TODO - REMOVE
     std::unique_ptr<ITransactionContextFactory>  factory_;
     unsigned int                                 maxRetries_;
-    std::unique_ptr<MainDicomTagsRegistry>       mainDicomTagsRegistry_;
+    boost::shared_ptr<MainDicomTagsRegistry>     mainDicomTagsRegistry_;  // "shared_ptr" because of PImpl
     bool                                         hasFlushToDisk_;
 
     void NormalizeLookup(std::vector<DatabaseConstraint>& target,
--- a/OrthancServer/Sources/OrthancWebDav.cpp	Wed Mar 10 15:59:03 2021 +0100
+++ b/OrthancServer/Sources/OrthancWebDav.cpp	Wed Mar 10 17:15:01 2021 +0100
@@ -50,7 +50,6 @@
 static const char* const BY_DATES = "by-dates";
 static const char* const BY_UIDS = "by-uids";
 static const char* const UPLOADS = "uploads";
-static const char* const MAIN_DICOM_TAGS = "MainDicomTags";
 static const char* const STUDY_INFO = "study.json";
 static const char* const SERIES_INFO = "series.json";
 
--- a/OrthancServer/Sources/ServerIndex.cpp	Wed Mar 10 15:59:03 2021 +0100
+++ b/OrthancServer/Sources/ServerIndex.cpp	Wed Mar 10 17:15:01 2021 +0100
@@ -387,113 +387,6 @@
   };
 
 
-  class ServerIndex::MainDicomTagsRegistry : public boost::noncopyable
-  {
-  private:
-    class TagInfo
-    {
-    private:
-      ResourceType  level_;
-      DicomTagType  type_;
-
-    public:
-      TagInfo()
-      {
-      }
-
-      TagInfo(ResourceType level,
-              DicomTagType type) :
-        level_(level),
-        type_(type)
-      {
-      }
-
-      ResourceType GetLevel() const
-      {
-        return level_;
-      }
-
-      DicomTagType GetType() const
-      {
-        return type_;
-      }
-    };
-      
-    typedef std::map<DicomTag, TagInfo>   Registry;
-
-
-    Registry  registry_;
-      
-    void LoadTags(ResourceType level)
-    {
-      {
-        const DicomTag* tags = NULL;
-        size_t size;
-  
-        ServerToolbox::LoadIdentifiers(tags, size, level);
-  
-        for (size_t i = 0; i < size; i++)
-        {
-          if (registry_.find(tags[i]) == registry_.end())
-          {
-            registry_[tags[i]] = TagInfo(level, DicomTagType_Identifier);
-          }
-          else
-          {
-            // These patient-level tags are copied in the study level
-            assert(level == ResourceType_Study &&
-                   (tags[i] == DICOM_TAG_PATIENT_ID ||
-                    tags[i] == DICOM_TAG_PATIENT_NAME ||
-                    tags[i] == DICOM_TAG_PATIENT_BIRTH_DATE));
-          }
-        }
-      }
-
-      {
-        std::set<DicomTag> tags;
-        DicomMap::GetMainDicomTags(tags, level);
-
-        for (std::set<DicomTag>::const_iterator
-               tag = tags.begin(); tag != tags.end(); ++tag)
-        {
-          if (registry_.find(*tag) == registry_.end())
-          {
-            registry_[*tag] = TagInfo(level, DicomTagType_Main);
-          }
-        }
-      }
-    }
-
-  public:
-    MainDicomTagsRegistry()
-    {
-      LoadTags(ResourceType_Patient);
-      LoadTags(ResourceType_Study);
-      LoadTags(ResourceType_Series);
-      LoadTags(ResourceType_Instance); 
-    }
-
-    void LookupTag(ResourceType& level,
-                   DicomTagType& type,
-                   const DicomTag& tag) const
-    {
-      Registry::const_iterator it = registry_.find(tag);
-
-      if (it == registry_.end())
-      {
-        // Default values
-        level = ResourceType_Instance;
-        type = DicomTagType_Generic;
-      }
-      else
-      {
-        level = it->second.GetLevel();
-        type = it->second.GetType();
-      }
-    }
-  };
-
-
   void ServerIndex::FlushThread(ServerIndex* that,
                                 unsigned int threadSleepGranularityMilliseconds)
   {
--- a/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Wed Mar 10 15:59:03 2021 +0100
+++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Wed Mar 10 17:15:01 2021 +0100
@@ -708,14 +708,11 @@
   {
   private:
     ZipCommands&    commands_;
-    ServerContext&  context_;
     unsigned int    counter_;
 
   public:
-    MediaIndexVisitor(ZipCommands& commands,
-                      ServerContext& context) :
+    MediaIndexVisitor(ZipCommands& commands) :
       commands_(commands),
-      context_(context),
       counter_(0)
     {
     }
@@ -746,7 +743,6 @@
   class ArchiveJob::ZipWriterIterator : public boost::noncopyable
   {
   private:
-    TemporaryFile&                          target_;
     ServerContext&                          context_;
     ZipCommands                             commands_;
     std::unique_ptr<HierarchicalZipWriter>  zip_;
@@ -759,13 +755,12 @@
                       ArchiveIndex& archive,
                       bool isMedia,
                       bool enableExtendedSopClass) :
-      target_(target),
       context_(context),
       isMedia_(isMedia)
     {
       if (isMedia)
       {
-        MediaIndexVisitor visitor(commands_, context);
+        MediaIndexVisitor visitor(commands_);
         archive.Expand(context.GetIndex());
 
         commands_.AddOpenDirectory(MEDIA_IMAGES_FOLDER);