diff OrthancServer/ServerEnumerations.cpp @ 559:e0cfb413c86b find-move-scp

find scp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Sep 2013 16:22:21 +0200
parents 1b2cdc855bd3
children f64e3838d6e1
line wrap: on
line diff
--- a/OrthancServer/ServerEnumerations.cpp	Wed Sep 18 15:27:07 2013 +0200
+++ b/OrthancServer/ServerEnumerations.cpp	Wed Sep 18 16:22:21 2013 +0200
@@ -33,6 +33,7 @@
 
 #include "../Core/OrthancException.h"
 #include "../Core/EnumerationDictionary.h"
+#include "../Core/Toolbox.h"
 
 #include <boost/thread.hpp>
 
@@ -291,4 +292,30 @@
   }
 
 
+  ResourceType StringToResourceType(const char* type)
+  {
+    std::string s(type);
+    Toolbox::ToUpperCase(s);
+
+    if (s == "PATIENT")
+    {
+      return ResourceType_Patient;
+    }
+    else if (s == "STUDY")
+    {
+      return ResourceType_Study;
+    }
+    else if (s == "SERIES")
+    {
+      return ResourceType_Series;
+    }
+    else if (s == "INSTANCE" || s == "IMAGE")
+    {
+      return ResourceType_Instance;
+    }
+    else
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
 }