Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
2810:1e8c4ecd02f4 | 2811:7cfc8d266f41 |
---|---|
108 free_(job_); | 108 free_(job_); |
109 } | 109 } |
110 | 110 |
111 JobStepResult PluginsJob::ExecuteStep() | 111 JobStepResult PluginsJob::ExecuteStep() |
112 { | 112 { |
113 | 113 OrthancPluginJobStepStatus status = step_(job_); |
114 | |
115 switch (status) | |
116 { | |
117 case OrthancPluginJobStepStatus_Success: | |
118 return JobStepResult::Success(); | |
119 | |
120 case OrthancPluginJobStepStatus_Failure: | |
121 return JobStepResult::Failure(ErrorCode_Plugin); | |
122 | |
123 case OrthancPluginJobStepStatus_Continue: | |
124 return JobStepResult::Continue(); | |
125 | |
126 default: | |
127 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
128 } | |
114 } | 129 } |
115 | 130 |
116 void PluginsJob::SignalResubmit() | 131 void PluginsJob::SignalResubmit() |
117 { | 132 { |
118 reset_(job_); | 133 reset_(job_); |
119 } | 134 } |
120 | 135 |
121 void PluginsJob::ReleaseResources() | 136 void PluginsJob::ReleaseResources(JobReleaseReason reason) |
122 { | 137 { |
123 releaseResources_(job_); | 138 switch (reason) |
139 { | |
140 case JobReleaseReason_Success: | |
141 releaseResources_(job_, OrthancPluginJobReleaseReason_Success); | |
142 break; | |
143 | |
144 case JobReleaseReason_Failure: | |
145 releaseResources_(job_, OrthancPluginJobReleaseReason_Failure); | |
146 break; | |
147 | |
148 case JobReleaseReason_Canceled: | |
149 releaseResources_(job_, OrthancPluginJobReleaseReason_Canceled); | |
150 break; | |
151 | |
152 case JobReleaseReason_Paused: | |
153 releaseResources_(job_, OrthancPluginJobReleaseReason_Paused); | |
154 break; | |
155 | |
156 default: | |
157 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
158 } | |
124 } | 159 } |
125 | 160 |
126 float PluginsJob::GetProgress() | 161 float PluginsJob::GetProgress() |
127 { | 162 { |
128 return getProgress_(job_); | 163 return getProgress_(job_); |