diff Core/Enumerations.cpp @ 2646:740983056f9e jobs

StringToJobState
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 31 May 2018 17:30:22 +0200
parents 8da2cffc2378
children 193ef9c1b731
line wrap: on
line diff
--- a/Core/Enumerations.cpp	Wed May 30 10:50:57 2018 +0200
+++ b/Core/Enumerations.cpp	Thu May 31 17:30:22 2018 +0200
@@ -1464,6 +1464,39 @@
   }
 
 
+  JobState StringToJobState(const std::string& state)
+  {
+    if (state == "Pending")
+    {
+      return JobState_Pending;
+    }
+    else if (state == "Running")
+    {
+      return JobState_Running;
+    }
+    else if (state == "Success")
+    {
+      return JobState_Success;
+    }
+    else if (state == "Failure")
+    {
+      return JobState_Failure;
+    }
+    else if (state == "Paused")
+    {
+      return JobState_Paused;
+    }
+    else if (state == "Retry")
+    {
+      return JobState_Retry;
+    }
+    else
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+  }
+
+
   unsigned int GetBytesPerPixel(PixelFormat format)
   {
     switch (format)