changeset 789:55dae8c5a6ab

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 May 2014 18:43:34 +0200
parents 7ebe4bf87196
children 331eaf9d9d69
files OrthancServer/DicomModification.cpp OrthancServer/FromDcmtkBridge.cpp OrthancServer/FromDcmtkBridge.h OrthancServer/ServerEnumerations.h
diffstat 4 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomModification.cpp	Mon May 05 18:39:36 2014 +0200
+++ b/OrthancServer/DicomModification.cpp	Mon May 05 18:43:34 2014 +0200
@@ -269,7 +269,7 @@
     for (Replacements::const_iterator it = replacements_.begin(); 
          it != replacements_.end(); ++it)
     {
-      toModify.Replace(it->first, it->second, FromDcmtkBridge::ReplaceMode_InsertIfAbsent);
+      toModify.Replace(it->first, it->second, DicomReplaceMode_InsertIfAbsent);
     }
 
     // (4) Update the DICOM identifiers
--- a/OrthancServer/FromDcmtkBridge.cpp	Mon May 05 18:39:36 2014 +0200
+++ b/OrthancServer/FromDcmtkBridge.cpp	Mon May 05 18:43:34 2014 +0200
@@ -784,7 +784,7 @@
 
   void ParsedDicomFile::Replace(const DicomTag& tag,
                                 const std::string& value,
-                                FromDcmtkBridge::ReplaceMode mode)
+                                DicomReplaceMode mode)
   {
     DcmTagKey key(tag.GetGroup(), tag.GetElement());
     DcmElement* element = NULL;
@@ -795,14 +795,14 @@
       // This field does not exist, act wrt. the specified "mode"
       switch (mode)
       {
-        case FromDcmtkBridge::ReplaceMode_InsertIfAbsent:
+        case DicomReplaceMode_InsertIfAbsent:
           Insert(tag, value);
           break;
 
-        case FromDcmtkBridge::ReplaceMode_ThrowIfAbsent:
+        case DicomReplaceMode_ThrowIfAbsent:
           throw OrthancException(ErrorCode_InexistentItem);
 
-        case FromDcmtkBridge::ReplaceMode_IgnoreIfAbsent:
+        case DicomReplaceMode_IgnoreIfAbsent:
           return;
       }
     }
@@ -823,14 +823,12 @@
 
     if (tag == DICOM_TAG_SOP_CLASS_UID)
     {
-      Replace(DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, value,
-              FromDcmtkBridge::ReplaceMode_InsertIfAbsent);
+      Replace(DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, value, DicomReplaceMode_InsertIfAbsent);
     }
 
     if (tag == DICOM_TAG_SOP_INSTANCE_UID)
     {
-      Replace(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID, value, 
-              FromDcmtkBridge::ReplaceMode_InsertIfAbsent);
+      Replace(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID, value, DicomReplaceMode_InsertIfAbsent);
     }
   }
 
--- a/OrthancServer/FromDcmtkBridge.h	Mon May 05 18:39:36 2014 +0200
+++ b/OrthancServer/FromDcmtkBridge.h	Mon May 05 18:43:34 2014 +0200
@@ -35,6 +35,7 @@
 #include "../Core/DicomFormat/DicomInstanceHasher.h"
 #include "../Core/RestApi/RestApiOutput.h"
 #include "../Core/Toolbox.h"
+#include "ServerEnumerations.h"
 
 #include <dcmtk/dcmdata/dcdatset.h>
 #include <dcmtk/dcmdata/dcfilefo.h>
@@ -46,13 +47,6 @@
   class FromDcmtkBridge
   {
   public:
-    enum ReplaceMode
-    {
-      ReplaceMode_InsertIfAbsent,
-      ReplaceMode_ThrowIfAbsent,
-      ReplaceMode_IgnoreIfAbsent
-    };
-
     static void Convert(DicomMap& target, DcmDataset& dataset);
 
     static DicomTag GetTag(const DcmElement& element);
@@ -169,7 +163,7 @@
 
     void Replace(const DicomTag& tag,
                  const std::string& value,
-                 FromDcmtkBridge::ReplaceMode mode = FromDcmtkBridge::ReplaceMode_InsertIfAbsent);
+                 DicomReplaceMode mode = DicomReplaceMode_InsertIfAbsent);
 
     void RemovePrivateTags();
 
--- a/OrthancServer/ServerEnumerations.h	Mon May 05 18:39:36 2014 +0200
+++ b/OrthancServer/ServerEnumerations.h	Mon May 05 18:43:34 2014 +0200
@@ -70,6 +70,13 @@
     DicomRequestType_Store
   };
 
+  enum DicomReplaceMode
+  {
+    DicomReplaceMode_InsertIfAbsent,
+    DicomReplaceMode_ThrowIfAbsent,
+    DicomReplaceMode_IgnoreIfAbsent
+  };
+
 
   /**
    * WARNING: Do not change the explicit values in the enumerations