diff Plugins/Engine/PluginsJob.cpp @ 2811:7cfc8d266f41

reason for releasing resources in jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Sep 2018 12:32:02 +0200
parents 1e8c4ecd02f4
children ea7aea6f6a95
line wrap: on
line diff
--- a/Plugins/Engine/PluginsJob.cpp	Thu Sep 06 11:06:54 2018 +0200
+++ b/Plugins/Engine/PluginsJob.cpp	Thu Sep 06 12:32:02 2018 +0200
@@ -110,7 +110,22 @@
 
   JobStepResult PluginsJob::ExecuteStep()
   {
-    
+    OrthancPluginJobStepStatus status = step_(job_);
+
+    switch (status)
+    {
+      case OrthancPluginJobStepStatus_Success:
+        return JobStepResult::Success();
+
+      case OrthancPluginJobStepStatus_Failure:
+        return JobStepResult::Failure(ErrorCode_Plugin);
+
+      case OrthancPluginJobStepStatus_Continue:
+        return JobStepResult::Continue();
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
   }
 
   void PluginsJob::SignalResubmit()
@@ -118,9 +133,29 @@
     reset_(job_);
   }
 
-  void PluginsJob::ReleaseResources()
+  void PluginsJob::ReleaseResources(JobReleaseReason reason)
   {
-    releaseResources_(job_);
+    switch (reason)
+    {
+      case JobReleaseReason_Success:
+        releaseResources_(job_, OrthancPluginJobReleaseReason_Success);
+        break;
+
+      case JobReleaseReason_Failure:
+        releaseResources_(job_, OrthancPluginJobReleaseReason_Failure);
+        break;
+
+      case JobReleaseReason_Canceled:
+        releaseResources_(job_, OrthancPluginJobReleaseReason_Canceled);
+        break;
+
+      case JobReleaseReason_Paused:
+        releaseResources_(job_, OrthancPluginJobReleaseReason_Paused);
+        break;
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
   }
 
   float PluginsJob::GetProgress()