diff OrthancServer/ServerEnumerations.cpp @ 2335:174c3616ab6d

code review
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Jul 2017 10:25:25 +0200
parents ae6245053bcf
children 3ab96768d144
line wrap: on
line diff
--- a/OrthancServer/ServerEnumerations.cpp	Sat Jul 15 13:13:00 2017 +0200
+++ b/OrthancServer/ServerEnumerations.cpp	Mon Jul 17 10:25:25 2017 +0200
@@ -382,6 +382,9 @@
 
   ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer)
   {
+    ModalityManufacturer result;
+    bool obsolete = false;
+    
     if (manufacturer == "Generic")
     {
       return ModalityManufacturer_Generic;
@@ -410,21 +413,33 @@
     {
       return ModalityManufacturer_Vitrea;
     }
-    else if (manufacturer == "AgfaImpax" || manufacturer == "SyngoVia")
+    else if (manufacturer == "AgfaImpax" ||
+             manufacturer == "SyngoVia")
     {
-      LOG(WARNING) << "The " << manufacturer << " manufacturer is obsolete since Orthanc 1.2.1.  To guarantee compatibility with future Orthanc version, you should use \"GenericNoWildcardInDates\" instead in your configuration file.";
-      return ModalityManufacturer_GenericNoWildcardInDates;
+      result = ModalityManufacturer_GenericNoWildcardInDates;
+      obsolete = true;
     }
-    else if (manufacturer == "EFilm2" || manufacturer == "MedInria")
+    else if (manufacturer == "EFilm2" ||
+             manufacturer == "MedInria")
     {
-      LOG(WARNING) << "The " << manufacturer << " manufacturer is obsolete since Orthanc 1.2.1.  To guarantee compatibility with future Orthanc version, you should remove it from your configuration file.";
-
-      return ModalityManufacturer_Generic;
+      result = ModalityManufacturer_Generic;
+      obsolete = true;
     }
     else
     {
       throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
+
+    if (obsolete)
+    {
+      LOG(WARNING) << "The \"" << manufacturer << "\" manufacturer is obsolete since "
+                   << "Orthanc 1.2.1. To guarantee compatibility with future Orthanc "
+                   << "releases, you should replace it by \""
+                   << EnumerationToString(result)
+                   << "\" in your configuration file.";
+    }
+
+    return result;
   }